Symfony2教义合并 [英] Symfony2 Doctrine merge

查看:84
本文介绍了Symfony2教义合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 http://docs.doctrine -project.org/en/latest/reference/working-with-associations.html ,但我不知道什么是级联合并。我在其他地方见过

I am studying http://docs.doctrine-project.org/en/latest/reference/working-with-associations.html but I cannot figure out what cascade merge does. I have seen elsewhere that

$new_object = $em->merge($object); 

基于 $ object 。是否正确?

推荐答案

$ em-> merge()被用来拿一个已经从实体经理的背景中取出并重新附加它的实体。

$em->merge() is used to take an Entity which has been taken out of the context of the entity manager and 'reattach it'.


  • 如果实体从未被管理,则合并相当于持续。

  • 如果实体是分离或序列化(可能放入缓存),然后合并或多或少地查找数据存储中的实体的ID,然后从该点起始跟踪实体的任何更改。

级联合并将此行为扩展到要合并的关联实体。这意味着更改级联到关联,而不仅仅是被合并的实体。

Cascading a merge extends this behavior to associated entities of the one you are merging. This means that changes are cascaded to the associations and not just the entity being merged.

这篇关于Symfony2教义合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆