Doctrine 1.2.2 Usage Problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Doctrine 1.2.2 Usage Problem (/showthread.php?tid=30054) |
Doctrine 1.2.2 Usage Problem - El Forum - 05-01-2010 [eluser]djmccormick[/eluser] Hello Everyone, I have a question about Doctrine (I'm using 1.2.2 and integrated using this guide) and the way to query for data. Here is my code: Bootstrap: http://pastie.org/941280 Model: http://pastie.org/941275 Controller: http://pastie.org/941278 Controller debugging output: http://pastie.org/941290 Notice the controller and controller debugging output. I'm selecting only the username in the controller. The query it is generating according to echo $query->getSqlQuery() looks like this: Code: SELECT u.id AS u__id, u.username AS u__username FROM user u Yet the array returned by $users->toArray() has every field populated: Code: Array I don't understand why it is returning all data and not simply the field I requested. In the Doctrine 1.2 documentation they show a similar example (it's the first example under this heading) and it's not getting every field. There is a slot for every field but those that weren't requested are blank. Thank you in advance for any advice and tips from everyone. Regards, Dustin Doctrine 1.2.2 Usage Problem - El Forum - 05-01-2010 [eluser]easylancer[/eluser] Hi Dustin, I have changed your code a bit to use Doctrine Hydration system which is alot faster than toArray() function, give it a run and let me know the results. http://pastie.org/941386 Doctrine 1.2.2 Usage Problem - El Forum - 05-01-2010 [eluser]djmccormick[/eluser] Ah, that works without the extra data. Is toArray() querying for the additional data itself? At any rate I really appreciate you having had a look! Doctrine 1.2.2 Usage Problem - El Forum - 05-01-2010 [eluser]easylancer[/eluser] I am not too sure about the toArray() function as i try to avoid it as much as possible and user Doctrine Hydration instead. |