public function listAll() { $rs = $this->getDbTable()->fetchAll(); $entries = array(); foreach ($rs as $row) { $model = new Library_Business_Model_Publisher(); $model->setId($row->id)->setLocalizacao($row->localizacao)->setNome($row->nome)->setWebsite($row->website); $entries[] = $model; } return $entries; }
public function listAll() { $rs = $this->getDbTable()->fetchAll(); $entries = array(); foreach ($rs as $linha) { $model = new Library_Business_Model_Book(); $editora = $linha->findParentRow('Library_Business_DbTable_Publisher'); $autor = $linha->findParentRow('Library_Business_DbTable_Author'); $editora_model = new Library_Business_Model_Publisher(); $editora_model->setId($editora->id)->setLocalizacao($editora->localizacao)->setNome($editora->nome)->setWebsite($editora->website); $autor_model = new Library_Business_Model_Author(); $autor_model->setId($autor->id)->setNome($autor->nome)->setBiografia($autor->biografia); $model->setIsbn($linha->isbn)->setEditora($editora_model)->setAutor($autor_model)->setTitulo($linha->titulo)->setPaginas($linha->paginas)->setAno($linha->ano)->setResenha($linha->resenha); $entries[] = $model; } return $entries; }