protected function build() { $this->select[] = " area_comment_information.* "; $this->select[] = " user_account_information.username AS user_account_username "; $this->select[] = " area_information.slug AS area_information_slug "; $this->select[] = " area_information.title AS area_information_title "; $this->joins[] = " LEFT JOIN area_information ON area_information.id = area_comment_information.area_id "; $this->joins[] = " LEFT JOIN user_account_information ON user_account_information.id = area_comment_information.user_account_id "; if ($this->area) { if ($this->includeChildrenAreas && $this->includeParentAreas) { $this->joins[] = " LEFT JOIN cached_area_has_parent AS cached_area_has_parent_1 ON " . "cached_area_has_parent_1.area_id = area_comment_information.area_id AND cached_area_has_parent_1.has_parent_area_id = :area_id "; $this->joins[] = " LEFT JOIN cached_area_has_parent AS cached_area_has_parent_2 ON " . "cached_area_has_parent_2.has_parent_area_id = area_comment_information.area_id AND cached_area_has_parent_2.area_id = :area_id "; $this->where[] = " ( area_comment_information.area_id = :area_id OR " . "cached_area_has_parent_1.has_parent_area_id = :area_id OR cached_area_has_parent_2.area_id = :area_id )"; } else { if ($this->includeChildrenAreas) { $this->joins[] = " LEFT JOIN cached_area_has_parent ON " . "cached_area_has_parent.area_id = area_comment_information.area_id AND cached_area_has_parent.has_parent_area_id = :area_id "; $this->where[] = " ( area_comment_information.area_id = :area_id OR cached_area_has_parent.has_parent_area_id = :area_id )"; } else { if ($this->includeParentAreas) { $this->joins[] = " LEFT JOIN cached_area_has_parent ON " . "cached_area_has_parent.has_parent_area_id = area_comment_information.area_id AND cached_area_has_parent.area_id = :area_id "; $this->where[] = " ( area_comment_information.area_id = :area_id OR cached_area_has_parent.area_id = :area_id )"; } else { $this->where[] = " area_comment_information.area_id = :area_id "; } } } $this->params['area_id'] = $this->area->getId(); } if (!$this->include_deleted) { $this->where[] = " area_comment_information.is_deleted = '0' "; } if (!$this->include_closed_by_admin) { $this->where[] = " area_comment_information.is_closed_by_admin = '0' "; } }
/** */ public function setParentArea(AreaModel $parent_area) { $this->parent_area_id = $parent_area->getId(); }