I'm using PHP and Doctrine 2.0. All entities work fine, with the exception of the entity-relation detailed below (or other entities are failing where I'm not noticing it).
Consider the following entities:
/** @Entity */
class Target {
/**
* @ManyToOne(targetEntity="k\entity\Source", cascade={"persist"})
* @JoinColumn(name="basic_vacancy_id", nullable=false)
* @var \k\entity\Source
*/
$source;
...
}
/** @Entity */
class Source {
...
}
Now, when I call $target->getSource()
I get an instance of k\entity\proxy\kentitySourceProxy
(which is the correct proxy class). However, all the getters for Source's properties return NULL
.
What could I be doing wrong?
I've added the fetch="EAGER"
attribute to the relational annotation, and now everything seems to go just fine (except for the fact that loading is no longer lazy). What could cause Doctrine 2.0's lazy loading to break?