db = $db; return $this; } /** * Get search attribute * * @access public * @return string[] */ public function getAttributes() { return array('link'); } /** * Apply filter * * @access public * @return string */ public function apply() { $this->query->inSubquery(TaskModel::TABLE.'.id', $this->getSubQuery()); } /** * Get subquery * * @access protected * @return Table */ protected function getSubQuery() { return $this->db->table(TaskLinkModel::TABLE) ->columns( TaskLinkModel::TABLE.'.task_id' ) ->join(LinkModel::TABLE, 'id', 'link_id', TaskLinkModel::TABLE) ->ilike(LinkModel::TABLE.'.label', $this->value); } }