开发者

Symfony dynamic fixtures foreign key

It's possible to embed php code in symfony's yml fixture file. My tab开发者_StackOverflow社区le entry needs a foreign key id. Is it possible through the embedded php to get the last inserted id of the referenced table or any other way which doesn't involve setting the foreign ids manually?

Thanks in advance


Do not use ids in your fixture. Do not use foreign_key columns. Use relations instead, like this:

ACLass:
  a_instance:
    title: 'pwet'

BClass:
  b_instance:
    name: My b object
    AObject: a_instance
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜