Details
Description
i have these two entities:
namespace nuevo_paquete;
class Clase_01{
/**
* @Id
* @Column(name="id",type="integer",nullable=false)
* @GeneratedValue
*/
protected $id;
/**
* @ManyToOne(targetEntity="\paquete_02\Clase_03", inversedBy="clase_01", fetch="EXTRA_LAZY", cascade={"detach","merge"})
* @JoinColumn(name="clase_03", referencedColumnName="id")
*/
protected $clase_03;
/**
* @ManyToOne(targetEntity="\paquete_02\Clase_03", inversedBy="clase_01_1", fetch="EXTRA_LAZY", cascade={"detach","merge"})
* @JoinColumn(name="clase_03_1", referencedColumnName="id")
*/
protected $clase_03_1;
}
namespace paquete_02;
class Clase_03{
/**
* @Id
* @Column(name="id",type="integer",nullable=false)
* @GeneratedValue
*/
protected $id;
/**
* @OneToMany(targetEntity="\nuevo_paquete\Clase_01", mappedBy="clase_03", fetch="EXTRA_LAZY", cascade={"detach"})
*/
protected $clase_01;
/**
* @OneToMany(targetEntity="\nuevo_paquete\Clase_01", mappedBy="clase_03_1", fetch="EXTRA_LAZY", cascade={"detach"})
*/
protected $clase_01_1;
}
Clase_01 have two aggregation association with Clase_03
Clase_01 ------> Clase_03
| -----> Clase_03_1 |
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:
$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]
when i call get_clase_03() before detach the object, i can see the object Clase_03
ej:
$aux_orm = $em->find('nuevo_paquete\Clase_01', 1);
$aux_orm->getClase_03()->getId();
$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().']'; // [1]
echo '['.$aux_orm->getClase_03_1()->getId().']'; // [1]
Activity
Benjamin Eberlei
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Description |
i have these two entities:
namespace nuevo_paquete; class Clase_01{ /** * @Id * @Column(name="id",type="integer",nullable=false) * @GeneratedValue */ protected $id; /** * @ManyToOne(targetEntity="\paquete_02\Clase_03", inversedBy="clase_01", fetch="EXTRA_LAZY", cascade={"detach","merge"}) * @JoinColumn(name="clase_03", referencedColumnName="id") */ protected $clase_03; /** * @ManyToOne(targetEntity="\paquete_02\Clase_03", inversedBy="clase_01_1", fetch="EXTRA_LAZY", cascade={"detach","merge"}) * @JoinColumn(name="clase_03_1", referencedColumnName="id") */ protected $clase_03_1; .... } //------------------------------------------------ .... //------------------------------------------------ namespace paquete_02; class Clase_03{ /** * @Id * @Column(name="id",type="integer",nullable=false) * @GeneratedValue */ protected $id; /** * @OneToMany(targetEntity="\nuevo_paquete\Clase_01", mappedBy="clase_03", fetch="EXTRA_LAZY", cascade={"detach"}) */ protected $clase_01; /** * @OneToMany(targetEntity="\nuevo_paquete\Clase_01", mappedBy="clase_03_1", fetch="EXTRA_LAZY", cascade={"detach"}) */ protected $clase_01_1; } Clase_01 have two aggregation association with Clase_03 Clase_01 ------> Clase_03 |-----> Clase_03_1 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: //---------------------------------------- $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] //---------------------------------------- when i call get_clase_03() before detach the object, i can see the object Clase_03 ej: //---------------------------------------- $aux_orm = $em->find('nuevo_paquete\Clase_01', 1); $aux_orm->getClase_03()->getId(); $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().']'; // [1] echo '['.$aux_orm->getClase_03_1()->getId().']'; // [1] //---------------------------------------- |
i have these two entities:
namespace nuevo_paquete; {code} class Clase_01{ /** * @Id * @Column(name="id",type="integer",nullable=false) * @GeneratedValue */ protected $id; /** * @ManyToOne(targetEntity="\paquete_02\Clase_03", inversedBy="clase_01", fetch="EXTRA_LAZY", cascade={"detach","merge"}) * @JoinColumn(name="clase_03", referencedColumnName="id") */ protected $clase_03; /** * @ManyToOne(targetEntity="\paquete_02\Clase_03", inversedBy="clase_01_1", fetch="EXTRA_LAZY", cascade={"detach","merge"}) * @JoinColumn(name="clase_03_1", referencedColumnName="id") */ protected $clase_03_1; .... } //------------------------------------------------ .... //------------------------------------------------ namespace paquete_02; class Clase_03{ /** * @Id * @Column(name="id",type="integer",nullable=false) * @GeneratedValue */ protected $id; /** * @OneToMany(targetEntity="\nuevo_paquete\Clase_01", mappedBy="clase_03", fetch="EXTRA_LAZY", cascade={"detach"}) */ protected $clase_01; /** * @OneToMany(targetEntity="\nuevo_paquete\Clase_01", mappedBy="clase_03_1", fetch="EXTRA_LAZY", cascade={"detach"}) */ protected $clase_01_1; } {code} Clase_01 have two aggregation association with Clase_03 Clase_01 ------> Clase_03 |-----> Clase_03_1 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: {code} //---------------------------------------- $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] //---------------------------------------- {code} when i call get_clase_03() before detach the object, i can see the object Clase_03 ej: {code} //---------------------------------------- $aux_orm = $em->find('nuevo_paquete\Clase_01', 1); $aux_orm->getClase_03()->getId(); $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().']'; // [1] echo '['.$aux_orm->getClase_03_1()->getId().']'; // [1] //---------------------------------------- {code} |
Benjamin Eberlei
made changes -
| Status | Open [ 1 ] | Awaiting Feedback [ 10000 ] |
gabriel sancho
made changes -
| Attachment | project_debug.log [ 11214 ] |
gabriel sancho
made changes -
| Status | Awaiting Feedback [ 10000 ] | In Progress [ 3 ] |
Marco Pivetta
made changes -
| Assignee | Benjamin Eberlei [ beberlei ] | Marco Pivetta [ ocramius ] |
Marco Pivetta
made changes -
| Status | In Progress [ 3 ] | Awaiting Feedback [ 10000 ] |
Marco Pivetta
made changes -
| Description |
i have these two entities:
namespace nuevo_paquete; {code} class Clase_01{ /** * @Id * @Column(name="id",type="integer",nullable=false) * @GeneratedValue */ protected $id; /** * @ManyToOne(targetEntity="\paquete_02\Clase_03", inversedBy="clase_01", fetch="EXTRA_LAZY", cascade={"detach","merge"}) * @JoinColumn(name="clase_03", referencedColumnName="id") */ protected $clase_03; /** * @ManyToOne(targetEntity="\paquete_02\Clase_03", inversedBy="clase_01_1", fetch="EXTRA_LAZY", cascade={"detach","merge"}) * @JoinColumn(name="clase_03_1", referencedColumnName="id") */ protected $clase_03_1; .... } //------------------------------------------------ .... //------------------------------------------------ namespace paquete_02; class Clase_03{ /** * @Id * @Column(name="id",type="integer",nullable=false) * @GeneratedValue */ protected $id; /** * @OneToMany(targetEntity="\nuevo_paquete\Clase_01", mappedBy="clase_03", fetch="EXTRA_LAZY", cascade={"detach"}) */ protected $clase_01; /** * @OneToMany(targetEntity="\nuevo_paquete\Clase_01", mappedBy="clase_03_1", fetch="EXTRA_LAZY", cascade={"detach"}) */ protected $clase_01_1; } {code} Clase_01 have two aggregation association with Clase_03 Clase_01 ------> Clase_03 |-----> Clase_03_1 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: {code} //---------------------------------------- $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] //---------------------------------------- {code} when i call get_clase_03() before detach the object, i can see the object Clase_03 ej: {code} //---------------------------------------- $aux_orm = $em->find('nuevo_paquete\Clase_01', 1); $aux_orm->getClase_03()->getId(); $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().']'; // [1] echo '['.$aux_orm->getClase_03_1()->getId().']'; // [1] //---------------------------------------- {code} |
i have these two entities:
namespace nuevo_paquete; {code} class Clase_01{ /** * @Id * @Column(name="id",type="integer",nullable=false) * @GeneratedValue */ protected $id; /** * @ManyToOne(targetEntity="\paquete_02\Clase_03", inversedBy="clase_01", fetch="EXTRA_LAZY", cascade={"detach","merge"}) * @JoinColumn(name="clase_03", referencedColumnName="id") */ protected $clase_03; /** * @ManyToOne(targetEntity="\paquete_02\Clase_03", inversedBy="clase_01_1", fetch="EXTRA_LAZY", cascade={"detach","merge"}) * @JoinColumn(name="clase_03_1", referencedColumnName="id") */ protected $clase_03_1; } {code} {code} namespace paquete_02; class Clase_03{ /** * @Id * @Column(name="id",type="integer",nullable=false) * @GeneratedValue */ protected $id; /** * @OneToMany(targetEntity="\nuevo_paquete\Clase_01", mappedBy="clase_03", fetch="EXTRA_LAZY", cascade={"detach"}) */ protected $clase_01; /** * @OneToMany(targetEntity="\nuevo_paquete\Clase_01", mappedBy="clase_03_1", fetch="EXTRA_LAZY", cascade={"detach"}) */ protected $clase_01_1; } {code} Clase_01 have two aggregation association with Clase_03 Clase_01 ------> Clase_03 |-----> Clase_03_1 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: {code} $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] {code} when i call get_clase_03() before detach the object, i can see the object Clase_03 ej: {code} $aux_orm = $em->find('nuevo_paquete\Clase_01', 1); $aux_orm->getClase_03()->getId(); $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().']'; // [1] echo '['.$aux_orm->getClase_03_1()->getId().']'; // [1] {code} |
Marco Pivetta
made changes -
| Status | Awaiting Feedback [ 10000 ] | In Progress [ 3 ] |
Marco Pivetta
made changes -
| Status | In Progress [ 3 ] | Resolved [ 5 ] |
| Resolution | Duplicate [ 3 ] |
Marco Pivetta
made changes -
| Security | All [ 10000 ] |