where('`territoryLeader` = ?', 'y'); $select->where('`People2Area`.`areaId` = ?', $this->getAreaId()); return $select; } protected function _join(Zend_Db_Select $select = null) { $select = parent::_join($select); $select->join( $this->_getPair('People2Area'), '`People`.`id` = `People2Area`.`peopleId`' ); return $select; } protected function _order(Zend_Db_Select $select = null) { $select = parent::_order($select); $select->order('People.sorter'); return $select; } /** * @return array */ public function getArea() { $select = $this->_db->select(); $select->from($this->_getPair('DTerritoryMap')); $select->where('`id` = ?', $this->getAreaId()); return $this->_db->fetchRow($select); } public function setAreaId($areaId) { $this->_areaId = $areaId; } public function getAreaId() { return $this->_areaId; } }