Closed doctrinebot closed 8 years ago
Comment created by gabrielnn77:
if i call $em->find() i still not able to view the object
//----------------------------------------
$aux*orm = $em->find('nuevo_paquete\Clase*01', 1);
$em->detach($aux_orm);
$aux*s = serialize($aux*orm);
$aux*orm = unserialize($aux*s);
$aux*orm = $em->merge($aux*orm);
echo '['.$aux_orm->getId().']'; // [1]
echo '['.$aux*orm->getClase*03()->getId().']'; // [] expected : [1]
echo '['.$aux*orm->getClase_03*1()->getId().']'; // [1]
$aux*orm = $em->find('nuevo_paquete\Clase*01', 1);
echo '['.$aux_orm->getId().']'; // [1]
echo '['.$aux*orm->getClase*03()->getId().']'; // still empty [] expected : [1]
//---------------------------------------- and if i have another register referencing the same object of class_03, i can't view ej:
$aux*orm = $em->find('nuevo_paquete\Clase*01', 2);
echo '['.$aux_orm->getId().']'; // [2]
echo '['.$aux*orm->getClase*03()->getId().']'; // still empty [] expected : [1]
Comment created by amarquez:
i have the same problem
Comment created by @beberlei:
formatted code
Comment created by @beberlei:
Can you paste a var_dump() of class1 after you call detach and before serialize and then another one after you called unserialize? Also a var_dump of the serialized string $aux_s
Comment created by gabrielnn77:
var_dump in attached file
Comment created by gabrielnn77:
i found that if the class has more than two levels have the same problem by ex. i have to do
// class1 -> register id 1
// class2 -> register id 1
// class3 -> null, don't exist
$class2 = $class1->getClass2();
$class3 = $class2->getClass3();
$class3->getId();
otherwise doctrine insert new registers in database for class3 after unserialize
Comment created by gsesia:
I have same problems
Comment created by gabrielnn77:
if i declare in the entity annotation fetch="EAGER" works fine
Comment created by valentin:
I have the same problem.
From what I saw, if I use fetch: EAGER, all my distinct entities are merged indeed, but if a specific entity (instance) is in two different collections, only one collection will have this instance.
So, any news about this bug ?
Comment created by valentin:
I'm still trying to get my stuff works, and I'm now pretty sure that as soon as an object have to be merge more than once in a row (because of cascade associations), it end up being only in one collection, and lost for other entities.
I hope this could help.
Comment created by @ocramius:
I think this one is also related with DDC-1734 (noticed a lot of un-initialized objects).
[~gabrielnn77] can you please try initializing ALL of these related objects prior to detaching/serializing and repeat your checks?
Comment created by gabrielnn77:
How do I have to initialize the objects?
Comment created by @ocramius:
[~gabrielnn77] by calling any method that is not getId
on them.
This will initialize them
Comment created by @ocramius:
[~gabrielnn77] news on this one? Managed to verify it?
Comment created by @ocramius:
This may be a duplicate of DDC-2306
Comment created by @beberlei:
A related Github Pull-Request [GH-585] was closed https://github.com/doctrine/doctrine2/pull/585
Comment created by @ocramius:
This issue is valid only before the fix introduced at DDC-2306. Duplicate confirmed
Comment created by @doctrinebot:
A related Github Pull-Request [GH-585] was closed: https://github.com/doctrine/dbal/pull/585
Comment created by @doctrinebot:
A related Github Pull-Request [GH-1172] was assigned: https://github.com/doctrine/doctrine2/pull/1172
Comment created by @doctrinebot:
A related Github Pull-Request [GH-1172] was closed: https://github.com/doctrine/doctrine2/pull/1172
Issue was closed with resolution "Duplicate"
Jira issue originally created by user gabrielnn77:
i have these two entities:
namespace nuevo_paquete;
Clase_01 have two aggregation association with Clase_03
when serialize an object of class Clase_01 and then unserialize, i lost the reference to the object of class Clase_03 but i can see Clase_03_1
ej:
when i call get_clase_03() before detach the object, i can see the object Clase_03 ej: