Using class constants in Symfony routing
Yes you can use constants in annotations, just use the FQN of the class:
/** * @Route("/doSomething/{param}", name="route_name", defaults={"param"=Namespace\MyBundle\MyEntity::DEFAULT_TYPE})*/
If you are in the same namespace, or you import the class holding the constant, you can shorten it:
use Namespace\MyBundle\MyEntity;/** * @Route("/doSomething/{param}", name="route_name", defaults={"param"=MyEntity::DEFAULT_TYPE})*/