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;
 }
Exemple #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');
     }
 }
Exemple #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;
 }
 protected function fixtureUsers($data)
 {
     foreach ($data as $user) {
         $this->repository->insert($user);
     }
 }
Exemple #5
0
 protected function action()
 {
     $this->repository->delete($this->user);
 }