hi everyone! sorry for my bad english. begin..
$phql = "SELECT acl_role.*, user.*
FROM Myproj\Frontend\Models\Acl_role AS acl_role
JOIN Myproj\Frontend\Models\User AS user
ON
acl_role.id = user.acl_role_id
WHERE
user.email = '$email'
AND
user.password = '$pass'";
$res = $this->modelsManager->executeQuery($phql);
if($res->valid()){
$row = $res[0];
$row->user->acl_role = $row->acl_role;
$user = $row->user;
}
now in $user User model with relation model Role
Role 1-to-many User
I need change role to another
$role = Myproj\Frontend\Models\Acl_role::findFirst(Myproj\\Frontend\Models\Acl_role::ADMIN);
echo $user->acl_role_id; //1
$user->acl_role = $role // User: $this->belongsTo('acl_role_id', __NAMESPACE__.'\Acl_role', 'id',['alias' => 'acl_role']);
$user->acl_role_id = Myproj\\Frontend\Models\Acl_role::ADMIN;
echo $user->acl_role_id; //3 - so good
$user->save(); // return true, it s good too
echo $user->acl_role_id; //1 Shit!!!! Not good!
How I can save it ?