Reputation: 13
While going through a cakephp 3 tutorial about bookmarks and tags I've struggled with a problem: I want to add the third field to the users_tags
table (tag_type: important or not), but when it saves the data it rewrites previous values to the default database value of "tag_type"
.
Could you please help me figure out what I'm doing wrong?
Upvotes: 0
Views: 312
Reputation: 1972
If you added the tag_type column to the users_tags table after running bake commands, check $_accessible array value in entity file of the table i.e. src/Model/Entity/UsersTag.php and add an element with column name as key and true as value to make sure column value can be mass assigned
In your Form html of user add/edit page, add an input like this so that cakephp matches its value with proper column automatically when you create an entity in your controller :
echo $this->Form->input('tags.0._joinData.tag_type');
Upvotes: 1