开发者

Symfony dynamic fixtures foreign key

开发者 https://www.devze.com 2023-02-24 10:01 出处:网络
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 t

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

精彩评论

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

关注公众号