public function indexAction(Request $request): Response
{
$vacancies = $this->vacancyService
->search(
new VacancySearchValueObject($request),
new PaginationValueObject($request)
);
}
public function share(Request $request, Vacancy $vacancy, $respondByMyself = false): Response
{
if ($this->propositionService->checkCountPropositions($this->getUser())) {
return $this->redirectToRoute('propositions');
}
...
/**
* @param UserInterface $user
* @return bool
*/
public function checkCountPropositions(UserInterface $user): bool
{
if ((int)$this->propositionRepository->getTodayCountByUser($user) >= $user->getPropositionLimit()) {
$this->flash->add('error', 'You have reached the limit of daily propositions.');
return true;
}
return false;
}
public function getSimilar(Vacancy $vacancy): array
{
return $this->vacancyRepository->getSimilar($vacancy->getSpecialization()->getId(), $vacancy->getId());
}