Is it possible to use CONST or service global as parameter in annotation?

I’m trying to set a dynamic default value in doctrine ORM annotation for when I update my app.

Thus, instead of having

 * @ORMColumn(type="float", options={"default": "1.0"})
private $version;

I would have something like :

 * @ORMColumn(type="float", options={"default": "%version%"})
private $version;

I declared a const APP_VERSION AppKernel and then imported it in services.yaml under the name of appVersion.

Do you know if it’s possible to use either the const in AppKernel or the global in services.yaml as parameter in Doctrine ORM annotation?
Anyone know if it’s possible?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *