public function update(array $data) { $object = User::findFirstById($data['id']); if (!$object) { throw new \Exception('Object not found'); } $security = $this->getDI()->get('security'); $object->setUserFirstName($data['user_first_name']); $object->setUserLastName($data['user_last_name']); $object->setUserEmail($data['user_email']); $object->setUserPassword($security->hash($data['user_password'])); $object->setUserIsActive($data['user_is_active']); $o_acl_role = AclRoles::findFirstByName($data['user_acl_role']); if (!$o_acl_role) { throw new \Exception("Role {$user_role} does not exists"); } $o_user_role[0] = new UserRole(); $o_user_role[0]->setUserRole($data['user_acl_role']); $object->roles = $o_user_role; $object->profile->setUserProfileLocation($data['user_profile_location']); return $this->save($object, 'update'); }