I'm trying to implement deep copy functions with Doctrine 2, and I almost have it, except for a method on one of my entities that tries to cut certain records from an association before returning the collection.
The problem is that when I call getRoofAreas () below, I get an array of Proxy objects that I don't like in my deep code:
private $roofAreas; public function getRoofAreas() { $em = \Zend_Registry::get('em'); $q = $em->createQuery("select ra from \Entities\QuotingRoofAreas ra where ra.dateDeleted IS NULL and ra.customerId = " . $this->getId()); return $q->getResult(); }
but if I changed this to:
private $roofAreas; public function getRoofAreas() { return $roofAreas; }
then it will return a permanent collection that, when repeated, will receive the Entity objects that I want. The latter approach does not exclude remote areas of the roof, which is mandatory for my use.
Is there a way to get an Entity object for a proxy object?
Thanks in advance for any help anyone can provide.
source share