Users belongsTo Groups
$user = $users->find()->first(); //$user does not have a group loaded but uses LazyLoadTrait
$user->get('group'); //this will load a group into user
$user->unsetProperty('group');
$user->get('group') //this will load a group again
It could seem like a desired behaviour but consider this:
I expect that my Groups association will be removed from a DB. But lazy loader will load a group once again before saving an entity. I tried also unsetting a group_id property $user->unsetProperty('group_id'); but this fails too.
Consider following example:
It could seem like a desired behaviour but consider this:
I expect that my Groups association will be removed from a DB. But lazy loader will load a group once again before saving an entity. I tried also unsetting a group_id property
$user->unsetProperty('group_id');
but this fails too.I think that a
dirty()
check could fix the issue.