Project Versions

Table Of Contents

Previous topic

Class Phalcon\Mvc\Model\Query

Next topic

Class Phalcon\Mvc\Model\Query\Lang

This Page

Class Phalcon\Mvc\Model\Query\Builder

implements Phalcon\DI\InjectionAwareInterface

Helps to create PHQL queries using an OO interface

<?php

Methods

public __construct (array $params)

public Phalcon\Mvc\Model\Query\Builder setDI (Phalcon\DiInterface $dependencyInjector)

Sets the DependencyInjector container

public Phalcon\DiInterface getDI ()

Returns the DependencyInjector container

public Phalcon\Mvc\Model\Query\Builder columns (string|array $columns)

Sets the columns to be queried

public string|array getColumns ()

Return the columns to be queried

public Phalcon\Mvc\Model\Query\Builder from (string|array $models)

Sets the models who makes part of the query

public Phalcon\Mvc\Model\Query\Builder addFrom (string $model, string $alias)

Add a model to take part of the query

public string|array getFrom ()

Return the models who makes part of the query

public Phalcon\Mvc\Model\Query\Builder join (string $model, string $conditions, string $alias)

Sets the models who makes part of the query

public Phalcon\Mvc\Model\Query\Builder where (string $conditions)

Sets conditions for the query

public string|array getWhere ()

Return the conditions for the query

public Phalcon\Mvc\Model\Query\Builder orderBy (string $orderBy)

Sets a ORDER BY condition clause

public string|array getOrderBy ()

Return the set ORDER BY clause

public Phalcon\Mvc\Model\Query\Builder having (string $having)

Sets a HAVING condition clause

public string|array getHaving ()

Return the columns to be queried

public Phalcon\Mvc\Model\Query\Builder limit (int $limit, int $offset)

Sets a LIMIT clause

public string|array getLimit ()

Returns the current LIMIT clause

public Phalcon\Mvc\Model\Query\Builder groupBy (string $group)

Sets a LIMIT clause

public string getGroupBy ()

Returns the GROUP BY clause

public string getPhql ()

Returns a PHQL statement built based on the builder parameters

public Phalcon\Mvc\Model\Query getQuery ()

Returns the query built