/**
  * @param \DLigo\Animaltool\Domain\Model\User $user
  * @return void
  */
 public function deleteAction(User $user)
 {
     foreach ($user->getAccounts() as $account) {
         $this->accountRepository->remove($account);
     }
     $this->userRepository->remove($user);
     $this->addFlashMessage('Deleted a user.', '', \TYPO3\Flow\Error\Message::SEVERITY_OK, array(), 'flash.user.delete');
     $this->redirect('index');
 }
 /**
  * Create an admin account
  *
  * Creates a new account which has admin rights.
  *
  * @param string $identifier Account identifier, aka "user name"
  * @param string $password Plain text password for the new account
  * @param string $firstName First name of the account's holder
  * @param string $lastName Last name of the account's holder
  * @return void
  */
 public function createAccountCommand($identifier, $password, $firstName, $lastName)
 {
     $this->initRoles();
     $account = $this->accountFactory->createAccountWithPassword($identifier, $password, array('DLigo.Animaltool:Admin'));
     $accountApp = $this->accountFactory->createAccountWithPassword($identifier, $password, array('DLigo.Animaltool:Admin'), 'AppProvider');
     $user = new \DLigo\Animaltool\Domain\Model\User();
     $user->setFirstname($firstName);
     $user->setLastname($lastName);
     $user->setPhone('');
     $user->setStreet('');
     $user->setNumber('');
     $user->setZipCode('');
     $user->setCity('');
     $user->setRegion('');
     $user->setCountry('');
     $user->setComment('');
     $user->setLastBoxID(0);
     $this->userRepository->add($user);
     $account->setParty($user);
     $accountApp->setParty($user);
     $this->accountRepository->add($account);
     $this->accountRepository->add($accountApp);
     $this->outputLine('The account "%s" was created.', array($identifier));
 }
 /**
  * @param \DLigo\Animaltool\Domain\Model\Action $action
  * @return void
  */
 public function add($action)
 {
     $this->userRepository->update($action->getTeam());
     parent::add($action);
 }