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