/** * @secured */ public function handleBlockUser($id) { try { $user = $this->getUser($id); if ($user !== null) { $this->userEntity->blockUser($user); $this->usersFacade->saveUser($this->userEntity); // add item with null value into array to toggle block button in template $this->blockedUsersIDs[$user->getId()] = null; } $this->refresh('userRestriction'); $this->onBlockUser($this, $user); } catch (\Exception $e) { $this->flashMessage('Při blokaci uživatele nastala chyba.', 'error'); $this->redirect('this'); } }