-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Description
Currently we support !php/const
for constants in service files. It would be good to be able to use them in routing files as well.
Example
We have some routes that rely on constants, we currently have to put them in to a parameter and then we can use them in our routes
Currently we have:
staff_dashboard:
host: '%domain_staff%'
path: /dashboards/default/
Plus a parameter for domain_staff which actually comes from a constant DOMAIN_STAFF
.
We could do away with the parameter and just have:
staff_dashboard:
host: !php/const DOMAIN_STAFF
path: /dashboards/default/
Fix
In YamlFileLoader.php we change
$parsedConfig = $this->yamlParser->parseFile($path);
to
$parsedConfig = $this->yamlParser->parseFile($path, Yaml::PARSE_CONSTANT);