I'm wondering how if it's possible, to inject variable into my doctrine anotation :
<?php
/**
* @Entity
* @Table(name="ecommerce_products")
*/
class ECommerceProduct
{
}
Assuming ecommerce_products is a variable
Dont know if this is a recommended troubleshooting but it's fixed the issue. I use a constant as follow:
<?php
...
define('ProductsTable', 'ecommerce_products')
/**
* @Entity
* @Table(name=ProductsTable)
*/
class ECommerceProduct
{
}
Notice the absence of quotes. Thus symfony consideres it as a constant. What give us lot of ways to set it from anywhere outside.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.