How to display the form field value SET using checkboxlist?

In MySQL table there is a field of days of type SET that represents the set of days of the week. A model in Yii gets from the database and returns an attribute, days in a row, where the values are separated by commas. When using:
$form->field($model, 'days')->checkboxList(['PN'=>'Mon', 'Tue'=>'W'...]);

checkboxes are not marked, apparently it is expected that the value must be an array. As it so cleverly the line to replace in an array to make this code work? Well, or with minimal effort to rewrite this code so that the form has been marked in accordance with the data base days of the week.

UPD Probably need to create an additional attribute daysArray and store the value in an array. But you need two events: after obtaining the model data and before recording. The second event found: BeforeSave, can't find the event immediately after the data is read from the database.
March 19th 20 at 08:59
0 answer

Find more questions by tags Yii