Re:Scaling PHP Book: I will teach you to scale PHP to millio...
by dools on Tuesday June 05, 2012 @11:14PM
(#4072217)
PDO doesn't handle mapping of nested relationships, though which is where it falls down when compared to ActiveRecord implementations. For example I want to fetch an author and all of the author's books in a single query then loop over and print out author name, and each book. A standard ActiveRecord ORM will give you an array of authors where each author contains an array of books, where as with PDO you're still left to manually detect a change in author by a change in the primary key which is more complex than just writing a nested for loop.
[ Parent
| on HN ]
Re:Scaling PHP Book: I will teach you to scale PHP to millio...
by FuzzyDunlop on Friday June 08, 2012 @06:40PM
(#4086482)
Forgive me if I misunderstand, but if you can't pull this off in a single SQL query, then ActiveRecord can't either. It just hides the fact it's performing several queries to get what you want.