second that, your docs are very good, which is to say that
they don’t look like they were written by a coder 😊
one thing i keep banging my head against, and it’s probably
that i’m just thick or doing things bass ackward,
is iterating over an “open ended” list. Say I wanted a list
of the books in my inventory, including JOIN’d authors names.
given tables AUTHORS, BOOKS, and AUTHORS_BOOKS:
$b = new Book;
foreach ($p->book->get()->author->get()->all as $items) {
echo "ISBN: " . $items->book->isbn . "
";
echo "TITLE: " . $item->book->title; . "
";
echo "AUTHOR: " . $items->last_name .", ". $items->first_name;
}
produces:
ISBN: 9780755342365
TITLE: 101 Ways to Kill Your Boss
AUTHOR: Roumieu, Graham
The generated SQL:
SHOW COLUMNS FROM books
SHOW COLUMNS FROM authors
SELECT * FROM (`books`)
SELECT authors.* FROM (`authors`)
LEFT JOIN `authors_books` ON authors.id = author_id
LEFT JOIN `books` ON books.id = book_id
WHERE book.id = 1
Which is correct, exactly what I want, except that my
foreach loop stops there after 1, not continuing down
the list for each book in my inventory.
any suggestions or advice is appreciated!
and again, thanks for all your work with this library.