/** * @param $id * @param null|Zend_Db_Table_Select $select * @return array|null * @throws Zend_Db_Table_Exception * @throws Zend_Db_Table_Row_Exception */ public function fetchProductsRel($id, Zend_Db_Table_Select $select = null) { $result = $this->getDbTable()->find($id); if (0 == count($result)) { return null; } $category = $result->current(); $resultSet = $category->findManyToManyRowset("Catalog_Model_DbTable_Products", "Catalog_Model_DbTable_CategoriesXref", null, null, $select); $entries = array(); $products = new Catalog_Model_Mapper_Products(); foreach ($resultSet as $row) { $entry = new Catalog_Model_Products(); $entry = $products->_setDbData($row, $entry); $entries[] = $entry; } return $entries; }