@@ -11,4 +11,11 @@ class PageRepositoryQuery extends AbstractRepositoryQuery implements PageReposit | |||
{ | |||
parent::__construct($repository, 'r', $paginator); | |||
} | |||
public function filterBySlug(string $slug) | |||
{ | |||
return $this | |||
->andWhere('.slug = :slug') | |||
->setParameter('slug', $slug); | |||
} | |||
} |
@@ -2,6 +2,7 @@ | |||
namespace Lc\SovBundle\Repository\Site; | |||
use Lc\SovBundle\Model\Site\PageInterface; | |||
use Lc\SovBundle\Repository\AbstractStore; | |||
class PageStore extends AbstractStore implements PageStoreInterface | |||
@@ -12,4 +13,15 @@ class PageStore extends AbstractStore implements PageStoreInterface | |||
{ | |||
$this->query = $query; | |||
} | |||
//findPageBySlug | |||
public function getBySlug(string $slug): ?PageInterface | |||
{ | |||
$query = $this->query->create(); | |||
$query | |||
->filterBySlug($slug); | |||
return $query->findOne(); | |||
} | |||
} |