Source for file Abstract.php
Documentation is available at Abstract.php
* $Id: Query.php 1393 2007-05-19 17:49:16Z zYne $
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
* Doctrine_Query_Abstract
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @version $Revision: 1393 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* adds fields to the SELECT part of the query
* @param string $select Query SELECT part
* adds fields to the FROM part of the query
* @param string $from Query FROM part
* adds conditions to the WHERE part of the query
* @param string $where Query WHERE part
* @param mixed $params an array of parameters or a simple scalar
public function addWhere($where, $params =
array())
* adds IN condition to the query WHERE part
* @param mixed $params an array of parameters or a simple scalar
public function whereIn($expr, $params =
array())
$params = (array)
$params;
foreach ($params as $k =>
$value) {
$value =
$value->getSql();
$where =
$expr .
' IN (' .
implode(', ', $a) .
')';
* adds fields to the GROUP BY part of the query
* @param string $groupby Query GROUP BY part
* adds conditions to the HAVING part of the query
* @param string $having Query HAVING part
* @param mixed $params an array of parameters or a simple scalar
public function addHaving($having, $params =
array())
* adds fields to the ORDER BY part of the query
* @param string $orderby Query ORDER BY part
* sets the SELECT part of the query
* @param string $select Query SELECT part
public function select($select)
* Makes the query SELECT DISTINCT.
* @param bool $flag Whether or not the SELECT is DISTINCT (default true).
$this->parts['distinct'] = (bool)
$flag;
* Makes the query SELECT FOR UPDATE.
* @param bool $flag Whether or not the SELECT is FOR UPDATE (default true).
$this->parts[self::FOR_UPDATE] = (bool)
$flag;
* sets the query type to DELETE
$this->type =
self::DELETE;
* sets the UPDATE part of the query
* @param string $update Query UPDATE part
public function update($update)
$this->type =
self::UPDATE;
* sets the SET part of the query
* @param string $update Query UPDATE part
public function set($key, $value, $params =
null)
foreach ($key as $k =>
$v) {
$this->set($k, '?', array($v));
* sets the FROM part of the query
* @param string $from Query FROM part
public function from($from)
* appends an INNER JOIN to the FROM part of the query
* @param string $join Query INNER JOIN
* appends a LEFT JOIN to the FROM part of the query
* @param string $join Query LEFT JOIN
* sets the GROUP BY part of the query
* @param string $groupby Query GROUP BY part
* sets the WHERE part of the query
* @param string $join Query WHERE part
* @param mixed $params an array of parameters or a simple scalar
public function where($where, $params =
array())
//$this->_params = array();
* sets the HAVING part of the query
* @param string $having Query HAVING part
* @param mixed $params an array of parameters or a simple scalar
public function having($having, $params =
array())
* sets the ORDER BY part of the query
* @param string $orderby Query ORDER BY part
* sets the Query query limit
* @param integer $limit limit to be used for limiting the query results
public function limit($limit)
* sets the Query query offset
* @param integer $offset offset to be used for paginating the query
public function offset($offset)
* parses given DQL query part
* @param string $queryPartName the name of the query part
* @param string $queryPart query part to be parsed
* @param boolean $append whether or not to append the query part to its stack
* if false is given, this method will overwrite
* the given query part stack with $queryPart
* @return Doctrine_Query this object
abstract public function parseQueryPart($queryPartName, $queryPart, $append =
false);