src/Service/PageService.php line 55

Open in your IDE?
  1. <?php
  2. namespace App\Service;
  3. use App\Entity\Pages;
  4. use App\Repository\PagesRepository;
  5. class PageService
  6. {
  7. /**
  8. * @var PagesRepository
  9. */
  10. private $pagesRepository;
  11. public function __construct(PagesRepository $pagesRepository)
  12. {
  13. $this->pagesRepository = $pagesRepository;
  14. }
  15. public function getPage($type): ?Pages
  16. {
  17. return $this->pagesRepository->findOneBy(['type' => $type]);
  18. }
  19. public function getPrivacyPolicyPage(): ?Pages
  20. {
  21. return $this->getPage(Pages::TYPE_PRIVACY_POLICY);
  22. }
  23. public function getTermsPage(): ?Pages
  24. {
  25. return $this->getPage(Pages::TYPE_TERMS);
  26. }
  27. public function getProgramRulesPage(): ?Pages
  28. {
  29. return $this->getPage(Pages::TYPE_PROGRAM_RULES);
  30. }
  31. public function getHomepageHeroPage(): ?Pages
  32. {
  33. return $this->getPage(Pages::TYPE_HOMEPAGE_HERO);
  34. }
  35. public function getBrandsPage(): ?Pages
  36. {
  37. return $this->getPage(Pages::TYPE_BRANDS);
  38. }
  39. public function getRetailersPage(): ?Pages
  40. {
  41. return $this->getPage(Pages::TYPE_RETAILERS);
  42. }
  43. public function getAboutUsPage(): ?Pages
  44. {
  45. return $this->getPage(Pages::TYPE_ABOUT_US);
  46. }
  47. public function getNewsAndEventsPage(): ?Pages
  48. {
  49. return $this->getPage(Pages::TYPE_NEWS_AND_EVENTS);
  50. }
  51. }