protected function _fetchPageOptions($id, $idsOnly = true) { $entries = array(); $row = new Zend_Db_Table_Row(array('table' => $this, 'data' => array('id' => $id))); $optionsData = $row->findManyToManyRowset('Application_Model_DbTable_PageOption', 'Application_Model_DbTable_PageHasOption')->toArray(); if ($idsOnly) { if (empty($optionsData)) { return $optionsData; } foreach ($optionsData as $optionData) { $entries[] = $optionData['id']; } return $entries; } return $optionsData; }
/** * Finds primary keys of many to many rows * * @param \Zend_Db_Table_Row $row * @param string $matchTable * @param string $intersectionTable * @param string $calleRefRule * @param string $matcherRefRule * @return array */ public function findManyToManyRowset(\Zend_Db_Table_Row $row, $matchTable, $intersectionTable, $callRefRule = null, $matchRefRule = null) { $table = $this->getDbTable(); // TODO only primary keys $select = $table->select(false)->from($table->info("name"), $table->info("primary")); $results = $row->findManyToManyRowset($matchTable, $intersectionTable, $callRefRule, $matchRefRule); return $this->_loadByPrimaryKeys($results); }
private function getMailServices() { $select = $this->_serviceGroup->select()->where('i.ghost = ?', 'false'); $serviceRowset = $this->_serviceGroup->findManyToManyRowset('WsServiceMail', 'WsServiceGroupHasWsService', null, null, $select); return $serviceRowset->current(); }