浏览代码

ControllerTrait : getParameterBag() + AbstractStore : getOneByDevAlias()

develop
Guillaume 3 年前
父节点
当前提交
9931128e25
共有 2 个文件被更改,包括 11 次插入4 次删除
  1. +7
    -0
      Controller/ControllerTrait.php
  2. +4
    -4
      Repository/AbstractStore.php

+ 7
- 0
Controller/ControllerTrait.php 查看文件

@@ -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 查看文件

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

正在加载...
取消
保存