You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"array_key_exists(): Argument #1 ($key) must be a valid array offset type"
in ROOT/vendor/cakedc/enum/src/Model/Behavior/EnumBehavior.php at line 299
As far as I see the problem originates by the fact that after reading the visibility attribute is an object(Cake\ORM\Entity) but when I save the value a string is expected.
Because after
Hi,
I'm sorry but I have another problem after migration my application which uses Enum form Cake 3 to Cake 5:
I have an Entity e.g. Article which contains an enum attribute visibility.
The enum is defined as follows:
$this->addBehavior('CakeDC/Enum.Enum', ['lists' => [ 'visibility' => [ 'strategy' => 'const', 'prefix' => 'VISIBILITY', 'field' => 'visibility', 'translate' => true ] ]]);
When I read an existing entity and modify it in the controller,
$article = $this->Articles->get($id); $article->count_viewed = $article->count_viewed + 1; $this->Articles->save($article));
the save operation is throwing a TypeError
As far as I see the problem originates by the fact that after reading the visibility attribute is an object(Cake\ORM\Entity) but when I save the value a string is expected.
Because after
$article->visibility = $article->visibility->value;
saving ist possible.
The text was updated successfully, but these errors were encountered: