Bladeren bron

Page repo

develop
Charly 3 jaren geleden
bovenliggende
commit
b05fc330b4
2 gewijzigde bestanden met toevoegingen van 19 en 0 verwijderingen
  1. +7
    -0
      Repository/Site/PageRepositoryQuery.php
  2. +12
    -0
      Repository/Site/PageStore.php

+ 7
- 0
Repository/Site/PageRepositoryQuery.php Bestand weergeven

@@ -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 Bestand weergeven

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

Laden…
Annuleren
Opslaan