I have defined string and mixed attributes for my Record/Model.

'titel' => array(AttributeType::String),
'lage' => array(AttributeType::Mixed, 'required' => true),

If i try to save a record, the data will not be saved, if required=true is not defined! That happens with both, string and mixed attribute types.

But i want to save the records also with empty values. Whats wrong?


I found this The Active Record and added this to my model

public function rules(){
    return array(
        array('title', 'default', 'setOnEmpty' => true, 'value' => null),

But it doesnt change anything.

  • After you call $yourRecord->save(), does $yourRecord->getErrors() return anything? – Brad Bell Mar 27 '15 at 19:59
  • No, no errors at all. The log file shows that db Commands will be executed and the relevant values are definitely null. As soon as i change 'required' to true, the same values will be saved. – phaetons Mar 28 '15 at 10:34
  • There is something critically wrong with Craft here. Amateur hour. – Tyguy7 Sep 28 '17 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.