I'm using Symfony 3.4
I managed to get the PHP constant to work for a service (as described in the documentation). But I can't figure out how to get it to work in a routing file. Here's what I have so far.
Entity:
namespace CompanyName\AppBundle\Entity\SomeDirectory;
class MyEntity
{
public const STATUS__CREATED = 1;
}
routing.yml:
view_my_entity_with_status_created:
path: /created/
defaults:
_controller: "AppBundle:SomeOtherDirectory/Something:index"
status: !php/const CompanyName\AppBundle\Entity\SomeDirectory\MyEntity::STATUS__CREATED
SomethingController
:
public function indexAction(?int $status = null): Response
{
// ...
}
From what I can tell the !php/const
is being ignored since status is always null.