public function getVocabulary(User $user) { $randomUserVocabularyId = $this->userVocabularyRepository->getRandomUserVocabularyId($user->getId(), $this->correctAnswersLimit); $filter = new UserVocabularyFilter(); $filter->setId($randomUserVocabularyId); return $this->userVocabularyRepository->fetch($filter); }
public function findVocabulary($englishVocabulary, User $user) { $filter = new UserVocabularyFilter(); $filter->setEnglishVocabulary($englishVocabulary); $filter->setUserId($user->getId()); return $this->userVocabularyRepository->fetch($filter); }
private function findUserVocabulary(Vocabulary $vocabulary, User $user) { $filter = new UserVocabularyFilter(); $filter->setVocabularyId($vocabulary->getId()); $filter->setUserId($user->getId()); return $this->userVocabularyRepository->fetch($filter); }
public function getLearnedVocabularyByDayCumulative(User $user, Date $startDate, $dayInterval) { $dbData = $this->userVocabularyRepository->getLearnedVocabularyStatsByDate($user->getId(), $this->correctAnswersLimit, $startDate); $vocabularyCountBeforeDate = $this->userVocabularyRepository->getLearnedVocabularySumBeforeDate($user->getId(), $this->correctAnswersLimit, $startDate); $dbData = $this->vocabularyDataPreparer->getNewKeywordsByDay($dbData, $startDate, $dayInterval); $dbData = $this->addCumulativeCount($dbData, $vocabularyCountBeforeDate); return $dbData; }
public function sendToUser(MailMessage $mailMessage, User $recipientUser, EmailAddress $replyTo = null, EmailAddress $from = null) { if (!$recipientUser->getActive()) { throw new Exception('User ' . $recipientUser->getId() . ' is inactive'); } $recipientName = strlen($recipientUser->getName()) ? $recipientUser->getName() : null; $recipient = new EmailAddress($recipientUser->getEmail(), $recipientName); $this->sendToAddress($mailMessage, $recipient, $replyTo, $from); }
private function createNewPasswordUser($name, $email, $password, $ipAddress) { $user = new User($email); $user->setName($name); $user->setCreatedAt($this->dateTimeFactory->getCurrentDateTime()->toDateTime()); $user->setRegistrationIpAddress($ipAddress); $user->setRole(User::ROLE_USER); if ($password) { $user->setPassword(password_hash($password, PASSWORD_BCRYPT, ['cost' => $this->bcryptIterations])); } $this->userRepository->save($user); return $user; }
public function sendWelcomeEmail(User $user) { $mailVariables = array('name' => $user->getName()); $mailMessage = $this->templateFactory->create('welcomeEmail', __DIR__ . '/WelcomeEmailCreator', 'cs', $mailVariables); $this->mailer->sendToUser($mailMessage, $user); }