Answer the question
In order to leave comments, you need to log in
How to save the data from the model in 1 DB cell?
There is a model for a form with a bunch of fields, they can change over time, etc.
There is a model for the table (user_id, data)
Question 1:
how best to store serialize, json, more options?
Question 2: What is the best way to access form model data?
$model - will give an object, which is not needed, $model->atributes only returns the field names. Something twisted me.
Answer the question
In order to leave comments, you need to log in
how best to store serialize, json, other options?Roughly speaking json is better and faster. Serialize is more convenient if you push objects of your own classes into the database, which you most likely do not need.
getDataAsModel(){...}
, call validation and put it in the method setMyDataModel($dinModel)
, which will do what it needs and shove the $this->data = json_encode($data);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question