'city']; protected $_mapMarkerFields = [ 'id', 'name', 'address', 'address2', 'city', 'state', 'zip', 'utilityPhone', 'latitude', 'longitude' ]; protected $_companyId; protected function _getCompanySelect(array $columns = null) { $select = $this->_db->select(); $columns = (null === $columns) ? $this->getMapMarkerFields() : $columns; $select->from($this->_getPair('Company', 'c'), $columns); $select->where('`c`.`type` = ?', CompanyEntity::TYPE_REGULAR); $select->where('`c`.`status` IN (?)', [CompanyEntity::STATUS_ACTIVE, CompanyEntity::STATUS_INACTIVE]); $select->where('`c`.`latitude` IS NOT NULL'); $select->where('`c`.`longitude` IS NOT NULL'); $select->join($this->_getPair('CompanyUtilityCategory', 'cuc'), '`c`.`id` = `cuc`.`companyId`', []); $select->join($this->_getPair('UtilityCategory', 'uc'), '`uc`.`id` = `cuc`.`utilityCategoryId`', []); $select->where('`uc`.`enabled` = "y"'); return $select; } public function getMapMarkerFields() { return $this->_mapMarkerFields; } public function getMapMarkers() { $select = $this->_getCompanySelect(); if ($city = Qs_Array::get($this->_filter, 'city')) { Qs_Db_Filter::where($select, $this->getFilterFields(), $city); } if ($categoryId = Qs_Array::get($this->_filter, 'categoryId')) { $select->where('`uc`.`id` = ?', $categoryId, Qs_Db::INT_TYPE); } return $this->_db->fetchAll($select); } }