![]() |
Doctrine Model one-to-many relationship - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Doctrine Model one-to-many relationship (/showthread.php?tid=36888) |
Doctrine Model one-to-many relationship - El Forum - 12-18-2010 [eluser]TheJonas[/eluser] Hi everybody, I'm having a pretty tough time getting a 1:n association with Doctrine to work. Basically, there is a Relationship and a RelationshipType with each Relationship having one RelationshipType and each RelationshipType having pot. many Relationships. My Relationship.php (model) looks like this: Code: /** @Entity And my RelationshipType.php looks like this: Code: /** @Entity My tables look like this: Code: -- The problem definitely is the 1:n association as if I comment out the field then everythign works fine, if I run the code as posted here I get the following error: Quote:A PHP Error was encountered Can anybody point me into the direction of my mistake? I've been reading the Doctrine docs but somehow I can't seem to find the problem :-( Thank you very much in advance! Doctrine Model one-to-many relationship - El Forum - 12-19-2010 [eluser]TheJonas[/eluser] Hmm... I think I partly found the problem - if I change the fetching type of the relationship explicitly to eager it works. Apparently there is a problem with the lazy loading because there are no proxy objects. However, I do have $config->setAutoGenerateProxyClasses( TRUE ); in my Doctrine.php and from my understanding that should be enough to generate the proxy classes and load these. Any ideas on where the problem could be? And is there a way how can I see if the proxy classes are being generated properly? I tried searching my file system for files including "proxy" in their name and didn't come up with anything. I did run the doctrine console with the orm:generate-proxies command and it executed without writing anything to the console window... Thanks! Doctrine Model one-to-many relationship - El Forum - 08-02-2012 [eluser]Unknown[/eluser] I just had the same problem. Here is my solution: Check if your proxies folder exists, because doctrine will not create folders for you! You will find the folder definition in Doctrine.php My conf looks like this Code: $config->setProxyDir(APPPATH . 'models/Proxies'); So i created folder /models/Proxies and it all started to work. Hope this helps |