读取对象持续存在,但尚未用原则冲洗 [英] read objects persisted but not yet flushed with doctrine
问题描述
这里是我看到的问题。
i不能使用:
$ repository = $ this-> getDoctrine() - > getRepository('entity' );
$ my_object = $ repository-> findOneBy($ index);
在持久化的对象上,但不要冲洗!
i认为从DB读取getRepository,所以它不会找到一个没有刷新的对象。
我的问题:如何读取持久化的对象(我认为每个配置文件都有256个物理羽毛。
$($)每个配置文件都有256个物理羽毛。 b
$ b
每个配置文件都有1个 plumeOptions
记录。
code> plumeOptions ,我有一个cartridgeplume是一个FK为 PhysicalPlume
。
每个羽毛由 ID
(自动生成)和 INDEX
(用户生成)标识。 / p>
规则:我说配置文件1有 physical_plume_index
连接到它的3(=索引)。
现在,我想将具有所有相关数据的配置文件复制到另一个配置文件。
创建新配置文件。从旧的配置文件创建并复制新的256羽羽毛。
我想将新的个人资料链接到新的羽流索引3。
在此查看: http://pastebin.com/WFa8vkt1
我想你可能想看看这个功能:
$ entityManager-> getUnitOfWork() - > getScheduledEntityInsertions()
给你一个实体列表
嗯,我没有真正阅读你的问题,上面你会检索一个完整的列表(作为一个数组),但你不能用getRepository来查询它。我会尝试为你找到一些东西..
I'm new to symfony2 and doctrine. here is the problem as I see it. i cannot use :
$repository = $this->getDoctrine()->getRepository('entity');
$my_object = $repository->findOneBy($index);
on an object that is persisted, BUT NOT FLUSHED YET !! i think getRepository read from DB, so it will not find a not-flushed object.
my question: how to read those objects that are persisted (i think they are somewhere in a "doctrine session") to re-use them before i do flush my entire batch ?
every profile has 256 physical plumes.
every profile has 1 plumeOptions
record assigned to it.
In plumeOptions
, I have a cartridgeplume which is a FK for PhysicalPlume
.
every plume is identified by ID
(auto-generated) and an INDEX
(user-generated).
rule: I say profile 1 has physical_plume_index
number 3 (=index) connected to it.
now, I want to copy a profile with all its related data to another profile.
new profile is created. New 256 plumes are created and copied from older profile.
i want to link the new profile to the new plume index 3.
check here: http://pastebin.com/WFa8vkt1
I think you might want to have a look at this function:
$entityManager->getUnitOfWork()->getScheduledEntityInsertions()
Gives you back a list of entity objects which are persisting yet.
Hmm, I didn't really read your question well, with the above you will retrieve a full list (as an array) but you cannot query it like with getRepository. I will try found something for u..
这篇关于读取对象持续存在,但尚未用原则冲洗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!