implements Phalcon\Mvc\Model\CriteriaInterface, Phalcon\Di\InjectionAwareInterface
This class is used to build the array parameter required by Phalcon\Mvc\Model::find() and Phalcon\Mvc\Model::findFirst() using an object-oriented interface.
$robots = Robots::query() ->where("type = :type:") ->andWhere("year < 2000") ->bind(["type" => "mechanical"]) ->limit(5, 10) ->orderBy("name") ->execute();
Sets the DependencyInjector container
Returns the DependencyInjector container
Set a model on which the query will be executed
Returns an internal model name on which the criteria will be applied
Sets the bound parameters in the criteria This method replaces all previously set bound parameters
Sets the bind types in the criteria This method replaces all previously set bound parameters
Sets SELECT DISTINCT / SELECT ALL flag
Sets the columns to be queried
$criteria->columns( [ "id", "name", ] );
Adds an INNER join to the query
$criteria->join("Robots"); $criteria->join("Robots", "r.id = RobotsParts.robots_id"); $criteria->join("Robots", "r.id = RobotsParts.robots_id", "r"); $criteria->join("Robots", "r.id = RobotsParts.robots_id", "r", "LEFT");
Adds an INNER join to the query
$criteria->innerJoin("Robots"); $criteria->innerJoin("Robots", "r.id = RobotsParts.robots_id"); $criteria->innerJoin("Robots", "r.id = RobotsParts.robots_id", "r");
Adds a LEFT join to the query
$criteria->leftJoin("Robots", "r.id = RobotsParts.robots_id", "r");
Adds a RIGHT join to the query
$criteria->rightJoin("Robots", "r.id = RobotsParts.robots_id", "r");
Sets the conditions parameter in the criteria
Appends a condition to the current conditions using an AND operator (deprecated)
Appends a condition to the current conditions using an AND operator
Appends a condition to the current conditions using an OR operator
Appends a BETWEEN condition to the current conditions
$criteria->betweenWhere("price", 100.25, 200.50);
Appends a NOT BETWEEN condition to the current conditions
$criteria->notBetweenWhere("price", 100.25, 200.50);
Appends an IN condition to the current conditions
$criteria->inWhere("id", [1, 2, 3]);
Appends a NOT IN condition to the current conditions
$criteria->notInWhere("id", [1, 2, 3]);
Adds the conditions parameter to the criteria
Adds the order-by parameter to the criteria (deprecated)
Adds the order-by clause to the criteria
Adds the group-by clause to the criteria
Adds the having clause to the criteria
Adds the limit parameter to the criteria.
$criteria->limit(100); $criteria->limit(100, 200); $criteria->limit("100", "200");
Adds the “for_update” parameter to the criteria
Adds the “shared_lock” parameter to the criteria
Sets the cache options in the criteria This method replaces all previously set cache options
Returns the conditions parameter in the criteria
Returns the columns to be queried
Returns the conditions parameter in the criteria
Returns the limit parameter in the criteria, which will be an integer if limit was set without an offset, an array with ‘number’ and ‘offset’ keys if an offset was set with the limit, or null if limit has not been set.
Returns the order clause in the criteria
Returns the group clause in the criteria
Returns the having clause in the criteria
Returns all the parameters defined in the criteria
Builds a Phalcon\Mvc\Model\Criteria based on an input array like _POST
Executes a find using the parameters built with the criteria
© 2011–2017 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Model_Criteria.html