_getIndividualsCountExpr(); $columns['nextMeeting'] = $this->_getNextMeetingExpr(); $columns['documentsCount'] = $this->_getDocumentsContExpr(); return $columns; } protected function _getDocumentsContExpr() { $select = $this->_db->select(); $select->from($this->_getPair('CommitteeDocument', 'd'), 'COUNT(*)') ->where('`d`.`committeeId` = `Committee`.`id`'); return new Zend_Db_Expr('(' . $select . ')'); } protected function _getNextMeetingExpr() { $select = $this->_db->select(); $select->from($this->_getPair('Event', 'e'), ['nextMeeting' => 'startDate']) ->where('`e`.`type` = ?', EventEntity::TYPE_COMMITTEE) ->where('`e`.`committeeId` = `Committee`.`id`') ->where('`e`.`startDate` >= ?', date('Y-m-d H:i:s') ) ->order('e.startDate ASC') ->limit(1); return new Zend_Db_Expr('(' . $select . ')'); } protected function _getIndividualsCountExpr() { $select = $this->_db->select(); $select->from($this->_getPair('UserCommittee', 'uc'), 'COUNT(*)') ->where('`uc`.`committeeId` = `Committee`.`id`'); return new Zend_Db_Expr('(' . $select . ')'); } }