Hi all,

I have a model with a "value" property that is defined as a varchar() in the database. The data I will be saving to that value comes from the controller as an array. As per the documentation, I thought I could json_encode() it in the beforeSave() function, to convert it to a string.

However, I'm getting an error that $this->value is undefined in beforeSave(). Outputing the value, I see that while it's an array in the controller, it gets changed to NULL in the model before beforeSave() even gets called.

Should I be putting this behaviour somewhere else? I hate json_encode()-ing the data in the controller for something that should be internal to the model.