public function testConstruct() { $condition = new SimpleCondition($this->expression, $this->expression, Condition::OPERATOR_EQUALS); $this->assertEquals(Condition::OPERATOR_EQUALS, $condition->getOperator()); $this->assertEquals($this->expression, $condition->getLeftExpression()); $this->assertEquals($this->expression, $condition->getRightExpression()); }
/** * Create the SQL of a simple condition * @param zibo\library\database\manipulation\expression\condition\SimpleCondition $condition * @param boolean useAlias * @return string sql part of the simple condition */ protected function parseSimpleCondition(SimpleCondition $condition, $useAlias = true) { $expressionLeft = $condition->getLeftExpression(); $expressionRight = $condition->getRightExpression(); $operator = $condition->getOperator(); return $this->parseExpression($expressionLeft, $useAlias) . ' ' . $operator . ' ' . $this->parseExpression($expressionRight, $useAlias); }
/** * Processes the relations and the localization in the expressions used by the provided simple condition * @param zibo\library\database\manipulation\condition\SimpleCondition $condition Condition to process * @return zibo\library\database\manipulation\condition\SimpleCondition $condition Processed condition */ private function processSimpleCondition(SimpleCondition $condition) { $expressionLeft = $condition->getLeftExpression(); $expressionRight = $condition->getRightExpression(); $expressionLeft = $this->processExpression($expressionLeft, true); $expressionRight = $this->processExpression($expressionRight, true); return new SimpleCondition($expressionLeft, $expressionRight, $condition->getOperator()); }