예제 #1
0
 /**
  * @param $data
  * @return User
  * @throws \Nette\InvalidArgumentException
  */
 public function create($data)
 {
     $values = $this->validateInput($data, array('email', 'password', 'role'));
     if ($this->userFacade->getByEmail($values['email'])) {
         throw new \Nette\InvalidArgumentException('Email ' . $values['email'] . ' exist.');
     } else {
         $user = new \Flame\CMS\UserBundle\Model\User($values['email'], $this->authenticator->calculateHash($values['password']), $values['role']);
         $this->userFacade->save($user);
         return $user;
     }
 }