Explorar el Código

Page repo

feature/symfony6.1
Charly hace 2 años
padre
commit
b05fc330b4
Se han modificado 2 ficheros con 19 adiciones y 0 borrados
  1. +7
    -0
      Repository/Site/PageRepositoryQuery.php
  2. +12
    -0
      Repository/Site/PageStore.php

+ 7
- 0
Repository/Site/PageRepositoryQuery.php Ver fichero

@@ -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 Ver fichero

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

Cargando…
Cancelar
Guardar