ZF does't support such a feature yet. But you can achieve the same result by building the right SQL query your self.
I think your getBooksAuthors should look like this: public function getBooksAuthors() { $select = $this->select() ->setIntegrityCheck(false) ->from(array('b' => 'books'), array('id')) ->join(array('a' => 'authors'), 'b.id = a.id_book', array('authors'=>new Zend_Db_Expr('GROUP_CONCAT(author)'))) ->group('b.id'); } -- Regards, Vladas Diržys On Thu, Sep 17, 2009 at 15:07, aoohralex <aoohra...@gmail.com> wrote: > > I have in database two tables: > books: > - id PK > - title > > authors: > - id PK > - author > - id_book FK > > 1 book can have many authors. I want to learn ZF so database doesn't matter > (I know it should be that also 1 author can have many books and it > shouldn't > be column 'author' but column 'name' and 'surname'). > > I have: > public function getBooksAuthors() > { > $select = $this->select() > ->setIntegrityCheck(false) > ->from(array('b' => 'books')) > ->join(array('a' => 'authors'), 'b.id = a.id_book'); > } > > > public function indexAction() > { > $books = new Model_DbTable_Books(); > $this->view->list = $books->getBooksauthors(); > } > > > <?php foreach($this->list as $row): ?> > <?php echo $row['title']; ?> <?php echo $row['author']; ?> > <br/> > <?php endforeach; ?> > > > And I see: > Book 1 Ben Johnson > Book 1 Michael Great > Book 2 Alexander Mortensen > > And I would like to see: > Book 1 Ben Johnson Michael Great > Book 2 Alexander Mortensen > > In Symfony Framework and Doctrine ORM it was something called HYDRATION. I > could do this using something like this: > foreach ($list['Books'] as $book) > { > echo $book['title']; > foreach ($book['Authors'] as $author) > { > echo $row['author']; > } > echo '<br/>'; > } > > > How can I do this in ZF ? > -- > View this message in context: > http://www.nabble.com/HYDRATION-like-in-Doctrine-ORM-in-Symfony-Framework-tp25490065p25490065.html > Sent from the Zend Framework mailing list archive at Nabble.com. > >