/** * Applies this filter to a IcingaDoctrine_Query or exports it (depending * if the $dqlOnly is set) * * @param IcingaDoctrine_Query The query to apply this filter to * @param Boolean True to only return the dql * * * @author Jannis Moßhammer <*****@*****.**> **/ public function __toDQL(IcingaDoctrine_Query $q, $dqlOnly) { $connection = $q->getConnection(); $v = $this->formatValues($connection); $dql = $connection->quoteIdentifier($this->field) . " " . $this->operator; if (is_array($v)) { $dql .= " (" . implode(",", $v) . ")"; } else { $dql .= " " . $v; } if ($dqlOnly) { return $dql; } else { $q->where($dql); } return; }