<?php
namespace App\Service;
use App\Entity\Pages;
use App\Repository\PagesRepository;
class PageService
{
/**
* @var PagesRepository
*/
private $pagesRepository;
public function __construct(PagesRepository $pagesRepository)
{
$this->pagesRepository = $pagesRepository;
}
public function getPage($type): ?Pages
{
return $this->pagesRepository->findOneBy(['type' => $type]);
}
public function getPrivacyPolicyPage(): ?Pages
{
return $this->getPage(Pages::TYPE_PRIVACY_POLICY);
}
public function getTermsPage(): ?Pages
{
return $this->getPage(Pages::TYPE_TERMS);
}
public function getProgramRulesPage(): ?Pages
{
return $this->getPage(Pages::TYPE_PROGRAM_RULES);
}
public function getHomepageHeroPage(): ?Pages
{
return $this->getPage(Pages::TYPE_HOMEPAGE_HERO);
}
public function getBrandsPage(): ?Pages
{
return $this->getPage(Pages::TYPE_BRANDS);
}
public function getRetailersPage(): ?Pages
{
return $this->getPage(Pages::TYPE_RETAILERS);
}
public function getAboutUsPage(): ?Pages
{
return $this->getPage(Pages::TYPE_ABOUT_US);
}
public function getNewsAndEventsPage(): ?Pages
{
return $this->getPage(Pages::TYPE_NEWS_AND_EVENTS);
}
}