Symfony2 FosUserBundle and SonataUserBundle : overriding entities?

我的未来我决定 提交于 2019-12-04 11:42:30

In fact, it appear that the way i use fos and sonata user bundles force me to use XML definition. So for example adding a field called "city" you have to add these lines :

User.php (in /app/Application/Sonata/UserBundle/Entity/) :

protected $city;

User.orm.xml (in /app/Application/Sonata/UserBundle/Ressource/config/doctrine/) :

<field name="city" column="city" type="text"/>

Maybe putting this in the documentation of the bundles would be interesting for newbies ;)

I found a better solution if you want use annotations.

Delete UserBundle/Resorces/config/doctrine folder and you can use annotations in your UserBundle/Entity folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!