Helper class to create expression nodes (aka IExpression) of various types.
Examples (and the produced SQL code):
// "id" = 1 Expression::eq("id", 1); // "id" IS NOT NULL Expression::notNull("id"); @code // "type" IN ("completed", "pending") Expression::in("type", array("completed", "pending")); // "id" IN (1, 2) OR "id" IS NULL Expression::disjunction( Expression::inSet("id", array(1, 2), Expression::isNull("id") ); // "cost" / 2 > "discount" Expression::gt( Expression::div("cost", 2), "discount" ); // my favourite one: (checked=1) AND ( (time <2) OR (time > 10) ) Expression::conjunction( Expression::eq("checked", 1), Expression::orChain( Expression::lt("time", 2), Expression::gt("time", 10) ) ); // now this gracefully wrapped up in a bow =) // another one: WHERE (active = 1) AND (name LIKE '%alex%' OR email LIKE '%alex%') Expression::conjunction( Expression::eq("active", 1), Expression::disjunction( Expression::like("name", "%alex%"), Expression::like("email", "%alex%") ) );
Definition at line 67 of file Expression.class.php.

Static Public Member Functions | |
| static | add ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject + value. | |
| static | andChain () |
| Conjunction chain of expressions. | |
| static | between ($subject, $from, $to) |
| Creates an instance of binary expression node, representing the construction: subject between A and B. | |
| static | conjunction () |
| Creates the conjunction chain filling it with expressions passed separately as arguments. | |
| static | disjunction () |
| Creates the disjunction chain filling it with expressions passed separately as arguments. | |
| static | div ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject / value. | |
| static | eq ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject = value. | |
| static | gt ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject > value. | |
| static | gtEq ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject >= value. | |
| static | ilike ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject ILIKE value. | |
| static | in ($subject, array $set) |
| Creates an instance of binary expression node, representing the construction: subject in set. | |
| static | isFalse ($subject) |
| Creates an instance of binary expression node, representing the construction: subject IS FALSE. | |
| static | isNull ($subject) |
| Creates an instance of binary expression node, representing the construction: subject IS NULL. | |
| static | isTrue ($subject) |
| Creates an instance of binary expression node, representing the construction: subject IS TRUE. | |
| static | like ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject LIKE value. | |
| static | lt ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject < value. | |
| static | ltEq ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject <= value. | |
| static | mul ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject * value. | |
| static | negative ($subject) |
| Creates an instance of binary expression node, representing the construction: -subject. | |
| static | neq ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject != value. | |
| static | not ($subject) |
| Creates an instance of PrefixUnaryExpression with prefixed "NOT" logical operator to invert the value. | |
| static | notIlike ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject NOT ILIKE value. | |
| static | notIn ($subject, $set) |
| Creates an instance of binary expression node, representing the construction: subject not in set. | |
| static | notLike ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject NOT LIKE value. | |
| static | notNull ($subject) |
| Creates an instance of binary expression node, representing the construction: subject NOT NOT NULL. | |
| static | notSimilar ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject NOT SIMILAR TO value. | |
| static | orChain () |
| Disjunction chain of expressions. | |
| static | similar ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject SIMILAR TO value. | |
| static | sub ($subject, $value) |
| Creates an instance of binary expression node, representing the construction: subject - value. | |
| static Expression::add | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject + value.
| mixed | $subject logical subject | |
| mixed | $value value to add to the subject |
SQL example:
// "cost" + 2 Expression::add("cost", 2);
Definition at line 288 of file Expression.class.php.
References BinaryLogicalOperator::add().
| static Expression::andChain | ( | ) | [static] |
Conjunction chain of expressions.
Definition at line 557 of file Expression.class.php.
References ExpressionChainLogicalOperator::conditionAnd().
Referenced by conjunction().
| static Expression::between | ( | $ | subject, | |
| $ | from, | |||
| $ | to | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject between A and B.
| mixed | $subject logical subject | |
| mixed | $from the beginning of the range | |
| mixed | $to the end of the range |
SQL example:
// "price" BETWEEN 50 AND 100 Expression::between("price", 50, 100);
Definition at line 430 of file Expression.class.php.
| static Expression::conjunction | ( | ) | [static] |
Creates the conjunction chain filling it with expressions passed separately as arguments.
Example:
// "id" IN (1, 2) OR "id" IS NULL Expression::conjunction( Expression::inSet("id", array(1, 2), Expression::isNull("id") );
| IExpression | ... |
Definition at line 534 of file Expression.class.php.
References andChain().
Referenced by EntityQuery::andWhere(), and SelectQuery::andWhere().
| static Expression::disjunction | ( | ) | [static] |
Creates the disjunction chain filling it with expressions passed separately as arguments.
Example:
// "id" IN (1, 2) OR "id" IS NULL Expression::disjunction( Expression::inSet("id", array(1, 2), Expression::isNull("id") );
| IExpression | ... |
Definition at line 509 of file Expression.class.php.
References orChain().
Referenced by EntityQuery::orWhere(), and SelectQuery::orWhere().
| static Expression::div | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject / value.
| mixed | $subject logical subject | |
| mixed | $value value to divide the subject |
SQL example:
// "cost" / 2 Expression::div("cost", 2);
Definition at line 342 of file Expression.class.php.
References BinaryLogicalOperator::divide().
| static Expression::eq | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject = value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
SQL example:
// "id" = 1 Expression::eq("id", 1);
Definition at line 82 of file Expression.class.php.
References BinaryLogicalOperator::eq().
Referenced by ManyToManyContainer::dropAll(), RdbmsDao::dropEntityById(), and RdbmsDao::getEntityById().
| static Expression::gt | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject > value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
SQL example:
// "id" > 1 Expression::gt("id", 1);
Definition at line 119 of file Expression.class.php.
References BinaryLogicalOperator::greaterThan().
| static Expression::gtEq | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject >= value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
SQL example:
// "id" >= 1 Expression::gtEq("id", 1);
Definition at line 138 of file Expression.class.php.
References BinaryLogicalOperator::greaterOrEquals().
| static Expression::ilike | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject ILIKE value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
SQL example:
// "name" ILIKE "mobi%" Expression::ilike("name", "mobi%");
Definition at line 228 of file Expression.class.php.
References BinaryLogicalOperator::ilike().
| static Expression::in | ( | $ | subject, | |
| array $ | set | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject in set.
| mixed | $subject logical subject | |
| array | $set set of value the subject should match |
SQL example:
// "type" IN ("completed", "pending") Expression::in("type", array("completed", "pending"));
Definition at line 448 of file Expression.class.php.
References InSetLogicalOperator::in().
Referenced by RdbmsDao::getByIds(), and ManyToManyContainer::save().
| static Expression::isFalse | ( | $ | subject | ) | [static] |
Creates an instance of binary expression node, representing the construction: subject IS FALSE.
| mixed | $subject logical subject |
SQL example:
// "hasSmth" IS FALSE Expression::isFalse("hasSmth");
Definition at line 410 of file Expression.class.php.
References UnaryPostfixLogicalOperator::isFalse().
| static Expression::isNull | ( | $ | subject | ) | [static] |
Creates an instance of binary expression node, representing the construction: subject IS NULL.
| mixed | $subject logical subject |
SQL example:
// "id" IS NULL Expression::isNull("id");
Definition at line 376 of file Expression.class.php.
References UnaryPostfixLogicalOperator::isNull().
| static Expression::isTrue | ( | $ | subject | ) | [static] |
Creates an instance of binary expression node, representing the construction: subject IS TRUE.
| mixed | $subject logical subject |
SQL example:
// "hasSmth" IS TRUE Expression::isTrue("hasSmth");
Definition at line 393 of file Expression.class.php.
References UnaryPostfixLogicalOperator::isTrue().
| static Expression::like | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject LIKE value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
SQL example:
// "name" LIKE "mobi%" Expression::like("name", "mobi%");
Definition at line 192 of file Expression.class.php.
References BinaryLogicalOperator::like().
| static Expression::lt | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject < value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
SQL example:
// "id" < 1 Expression::lt("id", 1);
Definition at line 156 of file Expression.class.php.
References BinaryLogicalOperator::lowerThan().
| static Expression::ltEq | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject <= value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
SQL example:
// "id" <= 1 Expression::ltEq("id", 1);
Definition at line 174 of file Expression.class.php.
References BinaryLogicalOperator::lowerOrEquals().
| static Expression::mul | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject * value.
| mixed | $subject logical subject | |
| mixed | $value value to multiply the subject |
SQL example:
// "cost" * 2 Expression::mul("cost", 2);
Definition at line 324 of file Expression.class.php.
References BinaryLogicalOperator::multiply().
| static Expression::negative | ( | $ | subject | ) | [static] |
Creates an instance of binary expression node, representing the construction: -subject.
| mixed | $subject logical subject |
Definition at line 490 of file Expression.class.php.
References PrefixUnaryLogicalOperator::minus().
| static Expression::neq | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject != value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
SQL example:
// "id" != 1 Expression::neq("id", 1);
Definition at line 100 of file Expression.class.php.
References BinaryLogicalOperator::notEquals().
| static Expression::not | ( | $ | subject | ) | [static] |
Creates an instance of PrefixUnaryExpression with prefixed "NOT" logical operator to invert the value.
| mixed | $subject logical subject |
Definition at line 479 of file Expression.class.php.
References PrefixUnaryLogicalOperator::not().
| static Expression::notIlike | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject NOT ILIKE value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
SQL example:
// "name" NOT ILIKE "mobi%" Expression::notIlike("name", "mobi%");
Definition at line 246 of file Expression.class.php.
References BinaryLogicalOperator::notIlike().
| static Expression::notIn | ( | $ | subject, | |
| $ | set | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject not in set.
| mixed | $subject logical subject | |
| array | $set set of value the subject should match |
SQL example:
// "type" NOT IN ("completed", "pending") Expression::notIn("type", array("completed", "pending"));
Definition at line 466 of file Expression.class.php.
References InSetLogicalOperator::notIn().
| static Expression::notLike | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject NOT LIKE value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
SQL example:
// "name" NOT LIKE "mobi%" Expression::notLike("name", "mobi%");
Definition at line 210 of file Expression.class.php.
References BinaryLogicalOperator::notLike().
| static Expression::notNull | ( | $ | subject | ) | [static] |
Creates an instance of binary expression node, representing the construction: subject NOT NOT NULL.
| mixed | $subject logical subject |
SQL example:
// "id" IS NOT NULL Expression::notNull("id");
Definition at line 359 of file Expression.class.php.
References UnaryPostfixLogicalOperator::isNotNull().
| static Expression::notSimilar | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject NOT SIMILAR TO value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
Definition at line 270 of file Expression.class.php.
References BinaryLogicalOperator::notSimilarTo().
| static Expression::orChain | ( | ) | [static] |
Disjunction chain of expressions.
Definition at line 548 of file Expression.class.php.
References ExpressionChainLogicalOperator::conditionOr().
Referenced by disjunction().
| static Expression::similar | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject SIMILAR TO value.
| mixed | $subject logical subject | |
| mixed | $value value to match the subject |
Definition at line 258 of file Expression.class.php.
References BinaryLogicalOperator::similarTo().
| static Expression::sub | ( | $ | subject, | |
| $ | value | |||
| ) | [static] |
Creates an instance of binary expression node, representing the construction: subject - value.
| mixed | $subject logical subject | |
| mixed | $value value to subtract from the subject |
SQL example:
// "cost" - 2 Expression::sub("cost", 2);
Definition at line 306 of file Expression.class.php.
References BinaryLogicalOperator::substract().