[CORE][Router] Remove duplicate service for URL generation, as that is actually the same object
This commit is contained in:
parent
420ebcda26
commit
dea9aa4dcf
@ -70,7 +70,6 @@ use Symfony\Component\HttpKernel\Event\RequestEvent;
|
|||||||
use Symfony\Component\HttpKernel\KernelEvents;
|
use Symfony\Component\HttpKernel\KernelEvents;
|
||||||
use Symfony\Component\Mailer\MailerInterface;
|
use Symfony\Component\Mailer\MailerInterface;
|
||||||
use Symfony\Component\Messenger\MessageBusInterface;
|
use Symfony\Component\Messenger\MessageBusInterface;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|
||||||
use Symfony\Component\Routing\RouterInterface;
|
use Symfony\Component\Routing\RouterInterface;
|
||||||
use Symfony\Component\Security\Core\Security as SSecurity;
|
use Symfony\Component\Security\Core\Security as SSecurity;
|
||||||
use Symfony\Component\Security\Http\Util\TargetPathTrait;
|
use Symfony\Component\Security\Http\Util\TargetPathTrait;
|
||||||
@ -92,7 +91,6 @@ class GNUsocial implements EventSubscriberInterface
|
|||||||
protected TranslatorInterface $translator;
|
protected TranslatorInterface $translator;
|
||||||
protected EntityManagerInterface $entity_manager;
|
protected EntityManagerInterface $entity_manager;
|
||||||
protected RouterInterface $router;
|
protected RouterInterface $router;
|
||||||
protected UrlGeneratorInterface $url_generator;
|
|
||||||
protected FormFactoryInterface $form_factory;
|
protected FormFactoryInterface $form_factory;
|
||||||
protected MessageBusInterface $message_bus;
|
protected MessageBusInterface $message_bus;
|
||||||
protected EventDispatcherInterface $event_dispatcher;
|
protected EventDispatcherInterface $event_dispatcher;
|
||||||
@ -116,7 +114,6 @@ class GNUsocial implements EventSubscriberInterface
|
|||||||
TranslatorInterface $trans,
|
TranslatorInterface $trans,
|
||||||
EntityManagerInterface $em,
|
EntityManagerInterface $em,
|
||||||
RouterInterface $router,
|
RouterInterface $router,
|
||||||
UrlGeneratorInterface $url_gen,
|
|
||||||
FormFactoryInterface $ff,
|
FormFactoryInterface $ff,
|
||||||
MessageBusInterface $mb,
|
MessageBusInterface $mb,
|
||||||
EventDispatcherInterface $ed,
|
EventDispatcherInterface $ed,
|
||||||
@ -136,7 +133,6 @@ class GNUsocial implements EventSubscriberInterface
|
|||||||
$this->translator = $trans;
|
$this->translator = $trans;
|
||||||
$this->entity_manager = $em;
|
$this->entity_manager = $em;
|
||||||
$this->router = $router;
|
$this->router = $router;
|
||||||
$this->url_generator = $url_gen;
|
|
||||||
$this->form_factory = $ff;
|
$this->form_factory = $ff;
|
||||||
$this->message_bus = $mb;
|
$this->message_bus = $mb;
|
||||||
$this->event_dispatcher = $ed;
|
$this->event_dispatcher = $ed;
|
||||||
@ -174,7 +170,7 @@ class GNUsocial implements EventSubscriberInterface
|
|||||||
Form::setFactory($this->form_factory);
|
Form::setFactory($this->form_factory);
|
||||||
Queue::setMessageBus($this->message_bus);
|
Queue::setMessageBus($this->message_bus);
|
||||||
Security::setHelper($this->security, $this->sanitizer);
|
Security::setHelper($this->security, $this->sanitizer);
|
||||||
Router::setServices($this->router, $this->url_generator);
|
Router::setRouter($this->router);
|
||||||
HTTPClient::setClient($this->client);
|
HTTPClient::setClient($this->client);
|
||||||
Formatting::setTwig($this->twig);
|
Formatting::setTwig($this->twig);
|
||||||
Cache::setupCache();
|
Cache::setupCache();
|
||||||
|
@ -64,12 +64,10 @@ abstract class Router
|
|||||||
public const NETWORK_PATH = UrlGeneratorInterface::NETWORK_PATH;
|
public const NETWORK_PATH = UrlGeneratorInterface::NETWORK_PATH;
|
||||||
|
|
||||||
public static ?SymfonyRouter $router = null;
|
public static ?SymfonyRouter $router = null;
|
||||||
public static ?UrlGeneratorInterface $url_gen = null;
|
|
||||||
|
|
||||||
public static function setServices($rtr, $gen): void
|
public static function setRouter($rtr): void
|
||||||
{
|
{
|
||||||
self::$router = $rtr;
|
self::$router = $rtr;
|
||||||
self::$url_gen = $gen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isAbsolute(string $url)
|
public static function isAbsolute(string $url)
|
||||||
@ -84,7 +82,7 @@ abstract class Router
|
|||||||
*/
|
*/
|
||||||
public static function url(string $id, array $args = [], int $type = self::ABSOLUTE_PATH): string
|
public static function url(string $id, array $args = [], int $type = self::ABSOLUTE_PATH): string
|
||||||
{
|
{
|
||||||
return self::$url_gen->generate($id, $args, $type);
|
return self::$router->generate($id, $args, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user