Skip to content

Commit

Permalink
Corrected code example
Browse files Browse the repository at this point in the history
  • Loading branch information
datag committed Sep 23, 2011
1 parent 0c5fc8a commit 9f02412
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions documentation/04-relationships.markdown
Expand Up @@ -360,9 +360,9 @@ $authors = AuthorQuery::create()
->find();
// $authors is a PropelObjectCollection
$authors->populateRelation('Book');
// now you can iterate over each author's book without further queries
foreach ($authors as $author) {
foreach ($authors->getBooks() as $book) { // no database query, the author already has a Books collection
// now you can iterate over each author's book without further queries
foreach ($author->getBooks() as $book) { // no database query, the author already has a Books collection
// do stuff with $book and $author
}
}
Expand Down

0 comments on commit 9f02412

Please sign in to comment.