[英]Doctrine entity relations on Symfony 2
I found the entity creation/modification on Symfony's documentation a bit confusing. 我发现Symfony文档中的实体创建/修改有点令人困惑。 I have my database tables created and the entity classes written.
我创建了数据库表并编写了实体类。 They are working fine and getting and saving objects normaly to the database.
它们工作正常,并且正常地将对象保存到数据库中。 If I want to change something in the model, say, the persist option of an association, do I have to do anything besides put the annotation in the entity class ?
如果我想改变模型中的某些东西,比如说,关联的持久选项,除了将注释放在实体类中之外,我还需要做什么吗? I mean like running a console command ?
我的意思是喜欢运行控制台命令? other example: If I add a column in the database and then write the respective fields and annotations manually in the entity class, will it be enough ?
其他示例:如果我在数据库中添加一个列,然后在实体类中手动编写相应的字段和注释,它就足够了吗? or I would still have to run some console command ?
或者我仍然需要运行一些控制台命令?
It will be enough. 这就够了。
But the usual practice is to add properties and annotations in Entity class first and then update the schema using the command 但通常的做法是先在Entity类中添加属性和注释,然后使用该命令更新模式
php app/console doctrine:schema:update --force
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.