I am using Symfony1.4.1 and this is using Doctrine 1.2.1 (I think).
I am trying to make a function that did all this above when I found one that already exists.
Try this in any function and look at the results:
$tmp=$this->toArray(TRUE); var_dump($tmp); $this->refreshRelated(); $tmp=$this->toArray(); var_dump($tmp); $tmp=$this->toArray(TRUE); var_dump($tmp); exit();
I am going to try two different things:
A / put $ this-> refreshRelated () in the constructor of all my model objects. B / write a function that takes an array representing the graph of the object I want to fill. Function call refereshRelatedGraph ($ objectGraphArray). With the correct structure of the array (having all the corresponding relationship names at each level), I could control which relationships are populated and which are not. One of them is to fill in only child, not parent, relationships. Another thing is that ERD / Schema / ObjectGraph has an element that "belongs" to more than one object (many of many, other special circumstances that I have), I could control which side of the relationship gets pre (not lazy) loaded.
user327312
source share