Reputation: 2557
I try to use lazy load on my project. But it didn work. Here is my relation definition:
/**
* @ORM\OneToMany(targetEntity="\Acme\TripBundle\Entity\TripRespond", mappedBy="trip", fetch="EXTRA_LAZY", cascade={"persist"})
*/
private $responds;
But when I var_dump my trip it returns with all related entities. What I am doing wrong?
Fetching of trips:
$trips = $this->getDoctrine()->getRepository('AcmeTripBundle:Trip')->searchByPoints($startPoint, $endPoint);
var_dump($trips);die;
Upvotes: 0
Views: 554
Reputation: 2723
Doctrine by default lazy load the object(s) unless any of the method is called. When the object(s) were lazy loaded it creates a proxy class with following properties and values:
["__IS_PROXY__"] => bool(true)
["__PROXY_INITIALIZED__"] => bool(false)
Try to dump your object with \Doctrine\Common\Util\Debug::dump($trips);
and see if such properties/values exist.
Upvotes: 1