/** * Transforms orm condition to sql expression for Nette Database. * @param string $condition * @param mixed $value * @return string */ public function parse($condition, $value, NetteSqlBuilder $builder) { list($chain, $operator) = CollectionConditionParser::parseCondition($condition); if ($operator === CollectionConditionParser::OPERATOR_EQUAL) { $operator = ''; } elseif ($operator === CollectionConditionParser::OPERATOR_NOT_EQUAL) { if (is_array($value) || $value === NULL || $value instanceof Traversable) { $operator = ' NOT'; } else { $operator = ' !='; } } else { $operator = " {$operator}"; } if (count($chain) === 1) { return $builder->getTableName() . '.' . $this->mapper->getStorageReflection()->convertEntityToStorageKey($chain[0]) . $operator; } return $this->parseCondition($chain, $this->mapper) . $operator; }