protected function build() { parent::build(); if ($this->human) { $this->joins[] = " JOIN event_has_human ON event_has_human.event_id = event_information.id AND event_has_human.human_id = :human_id AND event_has_human.removed_at IS NULL"; $this->params['human_id'] = $this->human->getId(); } else { if ($this->includeNoHumansOnly) { $this->joins[] = " LEFT JOIN event_has_human ON event_has_human.event_id = event_information.id AND event_has_human.removed_at IS NULL"; $this->where[] = " event_has_human.added_at IS NULL "; } } }