*$resultset = $this->modelsManager->createBuilder() * ->from('Robots') * ->join('RobotsParts') * ->limit(20) * ->orderBy('Robots.name') * ->getQuery() * ->execute(); * */ class Builder implements \Phalcon\Mvc\Model\Query\BuilderInterface, \Phalcon\DI\InjectionAwareInterface { protected $_dependencyInjector; protected $_columns; protected $_models; protected $_joins; protected $_conditions; protected $_group; protected $_having; protected $_order; protected $_limit; protected $_offset; protected $_forUpdate; protected $_sharedLock; protected $_bindParams; protected $_bindTypes; protected $_hiddenParamNumber; /** * \Phalcon\Mvc\Model\Query\Builder constructor * * * $params = array( * 'models' => array('Users'), * 'columns' => array('id', 'name', 'status'), * 'conditions' => "created > '2013-01-01' AND created < '2014-01-01'", * 'group' => array('id', 'name'), * 'having' => "name = 'Kamil'", * 'order' => array('name', 'id'), * 'limit' => 20, * 'offset' => 20, *); *$queryBuilder = new \Phalcon\Mvc\Model\Query\Builder($params); * * * @param array $params * @param \Phalcon\DI $dependencyInjector */ public function __construct($params=null, $dependencyInjector=null){ } /** * Sets the DependencyInjector container * * @param \Phalcon\DiInterface $dependencyInjector * @return \Phalcon\Mvc\Model\Query\Builder */ public function setDI($dependencyInjector){ } /** * Returns the DependencyInjector container * * @return \Phalcon\DiInterface */ public function getDI(){ } /** * Sets the columns to be queried * * * $builder->columns(array('id', 'name')); * * * @param string|array $columns * @return \Phalcon\Mvc\Model\Query\Builder */ public function columns($columns){ } /** * Return the columns to be queried * * @return string|array */ public function getColumns(){ } /** * Sets the models who makes part of the query * * * $builder->from('Robots'); * $builder->from(array('Robots', 'RobotsParts')); * * * @param string|array $models * @return \Phalcon\Mvc\Model\Query\Builder */ public function from($models){ } /** * Add a model to take part of the query * * * $builder->addFrom('Robots', 'r'); * * * @param string $model * @param string $alias * @return \Phalcon\Mvc\Model\Query\Builder */ public function addFrom($model, $alias=null){ } /** * Return the models who makes part of the query * * @return string|array */ public function getFrom(){ } /** * Adds a INNER join to the query * * * $builder->join('Robots'); * $builder->join('Robots', 'r.id = RobotsParts.robots_id'); * $builder->join('Robots', 'r.id = RobotsParts.robots_id', 'r'); * $builder->join('Robots', 'r.id = RobotsParts.robots_id', 'r', 'LEFT'); * * * @param string $model * @param string $conditions * @param string $alias * @param string $type * @return \Phalcon\Mvc\Model\Query\Builder */ public function join($model, $conditions=null, $alias=null, $type=null){ } /** * Adds a INNER join to the query * * * $builder->innerJoin('Robots'); * $builder->innerJoin('Robots', 'r.id = RobotsParts.robots_id'); * $builder->innerJoin('Robots', 'r.id = RobotsParts.robots_id', 'r'); * $builder->innerJoin('Robots', 'r.id = RobotsParts.robots_id', 'r', 'LEFT'); * * * @param string $model * @param string $conditions * @param string $alias * @return \Phalcon\Mvc\Model\Query\Builder */ public function innerJoin($model, $conditions=null, $alias=null){ } /** * Adds a LEFT join to the query * * * $builder->leftJoin('Robots', 'r.id = RobotsParts.robots_id', 'r'); * * * @param string $model * @param string $conditions * @param string $alias * @return \Phalcon\Mvc\Model\Query\Builder */ public function leftJoin($model, $conditions=null, $alias=null){ } /** * Adds a RIGHT join to the query * * * $builder->rightJoin('Robots', 'r.id = RobotsParts.robots_id', 'r'); * * * @param string $model * @param string $conditions * @param string $alias * @return \Phalcon\Mvc\Model\Query\Builder */ public function rightJoin($model, $conditions=null, $alias=null){ } /** * Sets the query conditions * * * $builder->where('name = "Peter"'); * $builder->where('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100)); * * * @param string $conditions * @param array $bindParams * @param array $bindTypes * @return \Phalcon\Mvc\Model\Query\Builder */ public function where($conditions, $bindParams=null, $bindTypes=null){ } /** * Appends a condition to the current conditions using a AND operator * * * $builder->andWhere('name = "Peter"'); * $builder->andWhere('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100)); * * * @param string $conditions * @param array $bindParams * @param array $bindTypes * @return \Phalcon\Mvc\Model\Query\Builder */ public function andWhere($conditions, $bindParams=null, $bindTypes=null){ } /** * Appends a condition to the current conditions using a OR operator * * * $builder->orWhere('name = "Peter"'); * $builder->orWhere('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100)); * * * @param string $conditions * @param array $bindParams * @param array $bindTypes * @return \Phalcon\Mvc\Model\Query\Builder */ public function orWhere($conditions, $bindParams=null, $bindTypes=null){ } /** * Appends a BETWEEN condition to the current conditions * * * $builder->betweenWhere('price', 100.25, 200.50); * * * @param string $expr * @param mixed $minimum * @param mixed $maximum * @return \Phalcon\Mvc\Model\Query\Builder */ public function betweenWhere($expr, $minimum, $maximum){ } /** * Appends a NOT BETWEEN condition to the current conditions * * * $builder->notBetweenWhere('price', 100.25, 200.50); * * * @param string $expr * @param mixed $minimum * @param mixed $maximum * @return \Phalcon\Mvc\Model\Query\Builder */ public function notBetweenWhere($expr, $minimum, $maximum){ } /** * Appends an IN condition to the current conditions * * * $builder->inWhere('id', [1, 2, 3]); * * * @param string $expr * @param array $values * @return \Phalcon\Mvc\Model\Query\Builder */ public function inWhere($expr, $values){ } /** * Appends a NOT IN condition to the current conditions * * * $builder->notInWhere('id', [1, 2, 3]); * * * @param string $expr * @param array $values * @return \Phalcon\Mvc\Model\Query\Builder */ public function notInWhere($expr, $values){ } /** * Return the conditions for the query * * @return string|array */ public function getWhere(){ } /** * Sets a ORDER BY condition clause * * * $builder->orderBy('Robots.name'); * $builder->orderBy(array('1', 'Robots.name')); * * * @param string $orderBy * @return \Phalcon\Mvc\Model\Query\Builder */ public function orderBy($orderBy){ } /** * Returns the set ORDER BY clause * * @return string|array */ public function getOrderBy(){ } /** * Sets a HAVING condition clause. You need to escape PHQL reserved words using [ and ] delimiters * * * $builder->having('SUM(Robots.price) > 0'); * * * @param string $having * @return \Phalcon\Mvc\Model\Query\Builder */ public function having($having){ } /** * Return the current having clause * * @return string|array */ public function getHaving(){ } /** * Sets a LIMIT clause, optionally a offset clause * * * $builder->limit(100); * $builder->limit(100, 20); * * * @param int $limit * @param int $offset * @return \Phalcon\Mvc\Model\Query\Builder */ public function limit($limit, $offset=null){ } /** * Returns the current LIMIT clause * * @return string|array */ public function getLimit(){ } /** * Sets an OFFSET clause * * * $builder->offset(30); * * * @param int $limit * @param int $offset * @return \Phalcon\Mvc\Model\Query\Builder */ public function offset($offset){ } /** * Returns the current OFFSET clause * * @return string|array */ public function getOffset(){ } /** * Sets a GROUP BY clause * * * $builder->groupBy(array('Robots.name')); * * * @param string $group * @return \Phalcon\Mvc\Model\Query\Builder */ public function groupBy($group){ } /** * Returns the GROUP BY clause * * @return string */ public function getGroupBy(){ } /** * Returns a PHQL statement built based on the builder parameters * * @return string */ public function getPhql(){ } /** * Returns the query built * * @return \Phalcon\Mvc\Model\Query */ public function getQuery(){ } } }