/** * * @return array A list of all Links. */ public function findAll() { $sql = "select * from rit_link"; $result = $this->getDb()->fetchAll($sql); // Convert query result to an array of domain objects $links = array(); foreach ($result as $row) { $linkId = $row['lnk_id']; $links[$linkId] = $this->buildDomainObject($row); if (null !== $row['cat_id']) { $sql2 = "select * from rit_categories"; $r2 = $this->getDb()->fetchAll($sql2); $cat = new Categorie(); $cat->setId($r2[0]['cat_id']); $cat->setName($r2[0]['cat_name']); $links[$linkId]->setArticle($cat); } } return $links; }