Files
kupshop/bundles/KupShop/KupShopBundle/Routing/TranslatedRoute.php
2025-08-02 16:30:27 +02:00

59 lines
1.8 KiB
PHP

<?php
namespace KupShop\KupShopBundle\Routing;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class TranslatedRoute.
*
* @Annotation
* @NamedArgumentConstructor
* @Target({"CLASS", "METHOD"})
*/
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
class TranslatedRoute extends Route
{
private $module;
private $notModule;
public function __construct(array|string|null $path = null, ?string $name = null, array $requirements = [], array $options = [], array $defaults = [], ?string $host = null, array|string $methods = [], array|string $schemes = [], ?string $condition = null, ?int $priority = null, ?string $locale = null, ?string $format = null, ?bool $utf8 = null, ?bool $stateless = null, ?string $env = null, ?string $module = null, ?string $notModule = null)
{
parent::__construct($path, $name, $requirements, $options, $defaults, $host, $methods, $schemes, $condition, $priority, $locale, $format, $utf8, $stateless, $env);
$this->module = $module;
$this->notModule = $notModule;
}
public function getOptions()
{
return array_merge(parent::getOptions(), [
'compiler_class' => 'KupShop\\KupShopBundle\\Routing\\Compiler\\TranslatedRouteCompiler',
'translated_route' => 'translated',
'module' => $this->getModule(),
'not_module' => $this->getNotModule(),
]);
}
public function getModule()
{
return $this->module;
}
public function setModule($module): void
{
$this->module = $module;
}
public function getNotModule(): ?string
{
return $this->notModule;
}
public function setNotModule(?string $notModule): void
{
$this->notModule = $notModule;
}
}