Explorar el Código

ControllerTrait : getParameterBag() + AbstractStore : getOneByDevAlias()

develop
Guillaume hace 3 años
padre
commit
9931128e25
Se han modificado 2 ficheros con 11 adiciones y 4 borrados
  1. +7
    -0
      Controller/ControllerTrait.php
  2. +4
    -4
      Repository/AbstractStore.php

+ 7
- 0
Controller/ControllerTrait.php Ver fichero

@@ -23,6 +23,7 @@ use Lc\SovBundle\Solver\Setting\SettingSolver;
use Lc\SovBundle\Translation\FlashBagTranslator;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -48,6 +49,7 @@ trait ControllerTrait
RequestStack::class => RequestStack::class,
EventDispatcherInterface::class => EventDispatcherInterface::class,
LoggerInterface::class => LoggerInterface::class,
ParameterBagInterface::class => ParameterBagInterface::class,
TranslatorInterface::class => TranslatorInterface::class,
TranslatorAdmin::class => TranslatorAdmin::class,
FilterManager::class => FilterManager::class,
@@ -159,6 +161,11 @@ trait ControllerTrait
return $this->get(EventDispatcherInterface::class);
}

public function getParameterBag(): ParameterBagInterface
{
return $this->get(ParameterBagInterface::class);
}

public function getTranslator(): TranslatorInterface
{
return $this->get(TranslatorInterface::class);

+ 4
- 4
Repository/AbstractStore.php Ver fichero

@@ -57,7 +57,7 @@ abstract class AbstractStore implements StoreInterface

public function getOneBySlug(string $slug, bool $isOnline = true, $query = null)
{
$query = $this->createQuery($query);
$query = $this->createDefaultQuery($query);
$query->filterBySlug($slug);

if ($isOnline) {
@@ -69,14 +69,14 @@ abstract class AbstractStore implements StoreInterface

public function getOneByDevAlias(string $devAlias, $query = null)
{
$query = $this->createQuery($query);
$query = $this->createDefaultQuery($query);
$query->filterByDevAlias($devAlias);
return $query->findOne();
}

public function getOneOnlineByDevAlias(string $devAlias, $query = null)
{
$query = $this->createQuery($query);
$query = $this->createDefaultQuery($query);
$query
->filterByDevAlias($devAlias)
->filterIsOnline();
@@ -86,7 +86,7 @@ abstract class AbstractStore implements StoreInterface

public function getOneByOldUrl(string $oldUrl, $query = null)
{
$query = $this->createQuery($query);
$query = $this->createDefaultQuery($query);
$query
->filterByOldUrl($oldUrl)
->filterIsOnline();

Cargando…
Cancelar
Guardar