/** * @param User $user * @param bool $validate Flag used to enable validation */ public function editUser(User $user, $validate = true) { if ($validate) { $this->validateUser($user); } $this->repository->save($user); $this->repository->synchronize(); }
/** * @param User $user * @return void */ public function removeUser(User $user) { if (!$this->repository->findById($user->getId())) { throw new NotExistingUserException(sprintf('User with [id = %d] does not exist', $user->getId())); } $this->repository->remove($user); $this->repository->synchronize(); }