Created
April 24, 2019 08:53
-
-
Save yahyaerturan/675daa234c0a9e07923fa39ab030afd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\EventSubscriber; | |
use Symfony\Component\Messenger\MessageBusInterface; | |
use Symfony\Component\Routing\RouterInterface; | |
use Twig\Environment; | |
class BaseEventSubscriber | |
{ | |
/** | |
* @var RouterInterface | |
*/ | |
private $router; | |
/** | |
* @var MessageBusInterface | |
*/ | |
private $messageBus; | |
/** | |
* @var Environment | |
*/ | |
private $twig; | |
public function __construct(MessageBusInterface $messageBus, RouterInterface $router, Environment $twig) | |
{ | |
$this->router = $router; | |
$context = $this->router->getContext(); | |
$context->setHost(getenv('BASE_URL')); | |
$context->setScheme(getenv('SCHEMA')); | |
$context->setBaseUrl(''); | |
$context->setParameter('_locale', 'tr_TR'); | |
$this->messageBus = $messageBus; | |
$this->twig = $twig; | |
} | |
/** | |
* @return RouterInterface | |
*/ | |
public function getRouter(): RouterInterface | |
{ | |
return $this->router; | |
} | |
/** | |
* @return MessageBusInterface | |
*/ | |
public function getMessageBus(): MessageBusInterface | |
{ | |
return $this->messageBus; | |
} | |
/** | |
* @return Environment | |
*/ | |
public function getTwig(): Environment | |
{ | |
return $this->twig; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment