Fixed user updated flow
Change-Id: I6bcfb7ffb049955253293902c56ce0dcd0d9e53a Signed-off-by: smarcet <smarcet@gmail.com>
This commit is contained in:
parent
efb6383371
commit
ec0ee247dc
@ -146,21 +146,22 @@ final class GroupService extends AbstractService implements IGroupService
|
||||
*/
|
||||
public function addUser2Group(Group $group, int $user_id): void
|
||||
{
|
||||
$this->tx_service->transaction(function() use($group, $user_id){
|
||||
$user = $this->tx_service->transaction(function() use($group, $user_id){
|
||||
$user = $this->user_repository->getById($user_id);
|
||||
if(is_null($user))
|
||||
throw new EntityNotFoundException();
|
||||
|
||||
$user->addToGroup($group);
|
||||
|
||||
try {
|
||||
if(Config::get("queue.enable_message_broker", false) == true)
|
||||
PublishUserUpdated::dispatch($user)->onConnection('message_broker');
|
||||
}
|
||||
catch (\Exception $ex){
|
||||
Log::warning($ex);
|
||||
}
|
||||
return $user;
|
||||
});
|
||||
|
||||
try {
|
||||
if(Config::get("queue.enable_message_broker", false) == true)
|
||||
PublishUserUpdated::dispatch($user)->onConnection('message_broker');
|
||||
}
|
||||
catch (\Exception $ex){
|
||||
Log::warning($ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -171,20 +172,22 @@ final class GroupService extends AbstractService implements IGroupService
|
||||
*/
|
||||
public function removeUserFromGroup(Group $group, int $user_id): void
|
||||
{
|
||||
$this->tx_service->transaction(function() use($group, $user_id){
|
||||
$user = $this->tx_service->transaction(function() use($group, $user_id){
|
||||
$user = $this->user_repository->getById($user_id);
|
||||
if(is_null($user))
|
||||
throw new EntityNotFoundException();
|
||||
|
||||
$user->removeFromGroup($group);
|
||||
|
||||
try {
|
||||
if(Config::get("queue.enable_message_broker", false) == true)
|
||||
PublishUserUpdated::dispatch($user)->onConnection('message_broker');
|
||||
}
|
||||
catch (\Exception $ex){
|
||||
Log::warning($ex);
|
||||
}
|
||||
return $user;
|
||||
});
|
||||
|
||||
try {
|
||||
if(Config::get("queue.enable_message_broker", false) == true)
|
||||
PublishUserUpdated::dispatch($user)->onConnection('message_broker');
|
||||
}
|
||||
catch (\Exception $ex){
|
||||
Log::warning($ex);
|
||||
}
|
||||
}
|
||||
}
|
@ -229,7 +229,7 @@ final class UserService extends AbstractService implements IUserService
|
||||
*/
|
||||
public function update(int $id, array $payload): IEntity
|
||||
{
|
||||
return $this->tx_service->transaction(function() use($id, $payload){
|
||||
$user = $this->tx_service->transaction(function() use($id, $payload){
|
||||
|
||||
$user = $this->repository->getById($id);
|
||||
if(is_null($user) || !$user instanceof User)
|
||||
@ -272,18 +272,18 @@ final class UserService extends AbstractService implements IUserService
|
||||
Log::warning(sprintf("UserService::update use id %s - password changed", $id));
|
||||
Event::fire(new UserPasswordResetSuccessful($user->getId()));
|
||||
}
|
||||
|
||||
try {
|
||||
if(Config::get("queue.enable_message_broker", false) == true)
|
||||
PublishUserUpdated::dispatch($user)->onConnection('message_broker');
|
||||
}
|
||||
catch (\Exception $ex){
|
||||
Log::warning($ex);
|
||||
}
|
||||
|
||||
return $user;
|
||||
|
||||
});
|
||||
|
||||
try {
|
||||
if(Config::get("queue.enable_message_broker", false) == true)
|
||||
PublishUserUpdated::dispatch($user)->onConnection('message_broker');
|
||||
}
|
||||
catch (\Exception $ex){
|
||||
Log::warning($ex);
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user