implements Phalcon\Mvc\Model\CriteriaInterface, Phalcon\DI\InjectionAwareInterface
This class allows 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(array("type" => "mechanical")) ->order("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 the columns to be queried
$criteria->columns(array('id', 'name'));
Adds a 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 a 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'); $criteria->innerJoin('Robots', 'r.id = RobotsParts.robots_id', 'r', 'LEFT');
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 parameter to the criteria
Adds the limit parameter to the criteria
Adds the “for_update” parameter to the criteria
Adds the “shared_lock” parameter to the criteria
Returns the conditions parameter in the criteria
Return the columns to be queried
Returns the conditions parameter in the criteria
Returns the limit parameter in the criteria
Returns the order parameter 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
Sets the cache options in the criteria This method replaces all previously set cache options
© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/2.0.0/api/Phalcon_Mvc_Model_Criteria.html