Browse Source

Page repo

develop
Charly 3 years ago
parent
commit
b05fc330b4
2 changed files with 19 additions and 0 deletions
  1. +7
    -0
      Repository/Site/PageRepositoryQuery.php
  2. +12
    -0
      Repository/Site/PageStore.php

+ 7
- 0
Repository/Site/PageRepositoryQuery.php View File

@@ -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);
}
}

+ 12
- 0
Repository/Site/PageStore.php View File

@@ -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();
}
}

Loading…
Cancel
Save