Exemplo n.º 1
0
 public function execute()
 {
     if (strlen($this->login) < self::MinLength) {
         throw new InvalidArgumentException('Search key too small');
     }
     $condition = new Request();
     $condition->likeFields = ['login' => $this->login];
     $condition->limit = self::Limit;
     $found = $this->repository->find($condition);
     return $found;
 }
Exemplo n.º 2
0
 protected function validateEmail()
 {
     if (empty($this->user->email->getValue())) {
         return;
     }
     $searchRequest = new Request();
     $searchRequest->fields = ['email' => $this->user->email->getValue()];
     $found = $this->repositoryInterface->findOne($searchRequest);
     if (!empty($found)) {
         throw new UserAlreadyExistsException('Email already registered');
     }
 }
Exemplo n.º 3
0
 /**
  * @return \Extasy\Users\User
  */
 protected function getUser()
 {
     if (empty($this->confirmationCode)) {
         throw new InvalidArgumentException('Confirmation code couldn`t be empty');
     }
     $request = new Request();
     $request->fields = ['confirmation_code' => $this->confirmationCode];
     $found = $this->repository->findOne($request);
     if (empty($found)) {
         throw new NotFoundException('User not found');
     }
     return $found;
 }
Exemplo n.º 4
0
 protected function fixtureUsers($data)
 {
     foreach ($data as $user) {
         $this->repository->insert($user);
     }
 }
Exemplo n.º 5
0
 protected function action()
 {
     $this->repository->delete($this->user);
 }