Commit 15beb5e4 authored by jwage's avatar jwage

[2.0] Removing Doctrine.php and removing references to some remaining Doctrine constants

parent 87fd08e4
<?php
/*
* $Id$
*
* 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.org>.
*/
/**
* Doctrine
* the base class of Doctrine framework
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @todo Remove all the constants, attributes to the new attribute system,
* All methods to appropriate classes.
* Finally remove this class.
*/
final class Doctrine
{
/**
* PDO derived constants
*/
const CASE_NATURAL = 0;
const CASE_UPPER = 1;
const CASE_LOWER = 2;
const CURSOR_FWDONLY = 0;
const CURSOR_SCROLL = 1;
const ERRMODE_EXCEPTION = 2;
const ERRMODE_SILENT = 0;
const ERRMODE_WARNING = 1;
const FETCH_ASSOC = 2;
const FETCH_BOTH = 4;
const FETCH_BOUND = 6;
const FETCH_CLASS = 8;
const FETCH_CLASSTYPE = 262144;
const FETCH_COLUMN = 7;
const FETCH_FUNC = 10;
const FETCH_GROUP = 65536;
const FETCH_INTO = 9;
const FETCH_LAZY = 1;
const FETCH_NAMED = 11;
const FETCH_NUM = 3;
const FETCH_OBJ = 5;
const FETCH_ORI_ABS = 4;
const FETCH_ORI_FIRST = 2;
const FETCH_ORI_LAST = 3;
const FETCH_ORI_NEXT = 0;
const FETCH_ORI_PRIOR = 1;
const FETCH_ORI_REL = 5;
const FETCH_SERIALIZE = 524288;
const FETCH_UNIQUE = 196608;
const NULL_EMPTY_STRING = 1;
const NULL_NATURAL = 0;
const NULL_TO_STRING = NULL;
const PARAM_BOOL = 5;
const PARAM_INPUT_OUTPUT = -2147483648;
const PARAM_INT = 1;
const PARAM_LOB = 3;
const PARAM_NULL = 0;
const PARAM_STMT = 4;
const PARAM_STR = 2;
const ATTR_AUTOCOMMIT = 0;
const ATTR_PREFETCH = 1;
const ATTR_TIMEOUT = 2;
const ATTR_ERRMODE = 3;
const ATTR_SERVER_VERSION = 4;
const ATTR_CLIENT_VERSION = 5;
const ATTR_SERVER_INFO = 6;
const ATTR_CONNECTION_STATUS = 7;
const ATTR_CASE = 8;
const ATTR_CURSOR_NAME = 9;
const ATTR_CURSOR = 10;
const ATTR_ORACLE_NULLS = 11;
const ATTR_PERSISTENT = 12;
const ATTR_STATEMENT_CLASS = 13;
const ATTR_FETCH_TABLE_NAMES = 14;
const ATTR_FETCH_CATALOG_NAMES = 15;
const ATTR_DRIVER_NAME = 16;
const ATTR_STRINGIFY_FETCHES = 17;
const ATTR_MAX_COLUMN_LEN = 18;
/**
* __construct
*
* @return void
* @throws Doctrine_Exception
*/
public function __construct()
{
throw new Doctrine_Exception('Doctrine is static class. No instances can be created.');
}
}
\ No newline at end of file
...@@ -749,77 +749,6 @@ class Connection ...@@ -749,77 +749,6 @@ class Connection
return $text; return $text;
} }
/**
* Removes any formatting in an sequence name using the 'seqname_format' option
*
* @param string $sqn string that containts name of a potential sequence
* @return string name of the sequence with possible formatting removed
*/
protected function _fixSequenceName($sqn)
{
$seqPattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $this->conn->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT)).'$/i';
$seqName = preg_replace($seqPattern, '\\1', $sqn);
if ($seqName && ! strcasecmp($sqn, $this->getSequenceName($seqName))) {
return $seqName;
}
return $sqn;
}
/**
* Removes any formatting in an index name using the 'idxname_format' option
*
* @param string $idx string that containts name of anl index
* @return string name of the index with possible formatting removed
*/
protected function _fixIndexName($idx)
{
$indexPattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $this->conn->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT)).'$/i';
$indexName = preg_replace($indexPattern, '\\1', $idx);
if ($indexName && ! strcasecmp($idx, $this->getIndexName($indexName))) {
return $indexName;
}
return $idx;
}
/**
* adds sequence name formatting to a sequence name
*
* @param string name of the sequence
* @return string formatted sequence name
*/
protected function _getSequenceName($sqn)
{
return sprintf($this->conn->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT),
preg_replace('/[^a-z0-9_\$.]/i', '_', $sqn));
}
/**
* adds index name formatting to a index name
*
* @param string name of the index
* @return string formatted index name
*/
protected function _getIndexName($idx)
{
return sprintf($this->conn->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT),
preg_replace('/[^a-z0-9_\$]/i', '_', $idx));
}
/**
* adds table name formatting to a table name
*
* @param string name of the table
* @return string formatted table name
*/
protected function _getTableName($table)
{
return $table;
/*
return sprintf($this->conn->getAttribute(Doctrine::ATTR_TBLNAME_FORMAT),
$table);*/
}
/** /**
* Gets the wrapped driver connection. * Gets the wrapped driver connection.
* *
......
...@@ -22,5 +22,4 @@ interface Connection ...@@ -22,5 +22,4 @@ interface Connection
public function rollBack(); public function rollBack();
public function errorCode(); public function errorCode();
public function errorInfo(); public function errorInfo();
} }
\ No newline at end of file
...@@ -43,7 +43,7 @@ interface Statement ...@@ -43,7 +43,7 @@ interface Statement
* If using the column name, be aware that the name should match * If using the column name, be aware that the name should match
* the case of the column, as returned by the driver. * the case of the column, as returned by the driver.
* @param string $param Name of the PHP variable to which the column will be bound. * @param string $param Name of the PHP variable to which the column will be bound.
* @param integer $type Data type of the parameter, specified by the Doctrine::PARAM_* constants. * @param integer $type Data type of the parameter, specified by the PDO::PARAM_* constants.
* @return boolean Returns TRUE on success or FALSE on failure * @return boolean Returns TRUE on success or FALSE on failure
*/ */
public function bindColumn($column, &$param, $type = null); public function bindColumn($column, &$param, $type = null);
...@@ -58,7 +58,7 @@ interface Statement ...@@ -58,7 +58,7 @@ interface Statement
* using question mark placeholders, this will be the 1-indexed position of the parameter * using question mark placeholders, this will be the 1-indexed position of the parameter
* *
* @param mixed $value The value to bind to the parameter. * @param mixed $value The value to bind to the parameter.
* @param integer $type Explicit data type for the parameter using the Doctrine::PARAM_* constants. * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants.
* *
* @return boolean Returns TRUE on success or FALSE on failure. * @return boolean Returns TRUE on success or FALSE on failure.
*/ */
...@@ -82,9 +82,9 @@ interface Statement ...@@ -82,9 +82,9 @@ interface Statement
* *
* @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter. * @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
* *
* @param integer $type Explicit data type for the parameter using the Doctrine::PARAM_* constants. To return * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants. To return
* an INOUT parameter from a stored procedure, use the bitwise OR operator to set the * an INOUT parameter from a stored procedure, use the bitwise OR operator to set the
* Doctrine::PARAM_INPUT_OUTPUT bits for the data_type parameter. * PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter.
* *
* @param integer $length Length of the data type. To indicate that a parameter is an OUT parameter * @param integer $length Length of the data type. To indicate that a parameter is an OUT parameter
* from a stored procedure, you must explicitly set the length. * from a stored procedure, you must explicitly set the length.
...@@ -148,32 +148,32 @@ interface Statement ...@@ -148,32 +148,32 @@ interface Statement
/** /**
* fetch * fetch
* *
* @see Doctrine::FETCH_* constants * @see Query::HYDRATE_* constants
* @param integer $fetchStyle Controls how the next row will be returned to the caller. * @param integer $fetchStyle Controls how the next row will be returned to the caller.
* This value must be one of the Doctrine::FETCH_* constants, * This value must be one of the Query::HYDRATE_* constants,
* defaulting to Doctrine::FETCH_BOTH * defaulting to Query::HYDRATE_BOTH
* *
* @param integer $cursorOrientation For a PDOStatement object representing a scrollable cursor, * @param integer $cursorOrientation For a PDOStatement object representing a scrollable cursor,
* this value determines which row will be returned to the caller. * this value determines which row will be returned to the caller.
* This value must be one of the Doctrine::FETCH_ORI_* constants, defaulting to * This value must be one of the Query::HYDRATE_ORI_* constants, defaulting to
* Doctrine::FETCH_ORI_NEXT. To request a scrollable cursor for your * Query::HYDRATE_ORI_NEXT. To request a scrollable cursor for your
* Doctrine_Adapter_Statement_Interface object, * Doctrine_Adapter_Statement_Interface object,
* you must set the Doctrine::ATTR_CURSOR attribute to Doctrine::CURSOR_SCROLL when you * you must set the PDO::ATTR_CURSOR attribute to Doctrine::CURSOR_SCROLL when you
* prepare the SQL statement with Doctrine_Adapter_Interface->prepare(). * prepare the SQL statement with Doctrine_Adapter_Interface->prepare().
* *
* @param integer $cursorOffset For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for which the * @param integer $cursorOffset For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for which the
* $cursorOrientation parameter is set to Doctrine::FETCH_ORI_ABS, this value specifies * $cursorOrientation parameter is set to Query::HYDRATE_ORI_ABS, this value specifies
* the absolute number of the row in the result set that shall be fetched. * the absolute number of the row in the result set that shall be fetched.
* *
* For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for * For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for
* which the $cursorOrientation parameter is set to Doctrine::FETCH_ORI_REL, this value * which the $cursorOrientation parameter is set to Query::HYDRATE_ORI_REL, this value
* specifies the row to fetch relative to the cursor position before * specifies the row to fetch relative to the cursor position before
* Doctrine_Adapter_Statement_Interface->fetch() was called. * Doctrine_Adapter_Statement_Interface->fetch() was called.
* *
* @return mixed * @return mixed
*/ */
public function fetch($fetchStyle = Doctrine::FETCH_BOTH, public function fetch($fetchStyle = Query::HYDRATE_BOTH,
$cursorOrientation = Doctrine::FETCH_ORI_NEXT, $cursorOrientation = Query::HYDRATE_ORI_NEXT,
$cursorOffset = null); $cursorOffset = null);
/** /**
...@@ -181,15 +181,15 @@ interface Statement ...@@ -181,15 +181,15 @@ interface Statement
* Returns an array containing all of the result set rows * Returns an array containing all of the result set rows
* *
* @param integer $fetchStyle Controls how the next row will be returned to the caller. * @param integer $fetchStyle Controls how the next row will be returned to the caller.
* This value must be one of the Doctrine::FETCH_* constants, * This value must be one of the Query::HYDRATE_* constants,
* defaulting to Doctrine::FETCH_BOTH * defaulting to Query::HYDRATE_BOTH
* *
* @param integer $columnIndex Returns the indicated 0-indexed column when the value of $fetchStyle is * @param integer $columnIndex Returns the indicated 0-indexed column when the value of $fetchStyle is
* Doctrine::FETCH_COLUMN. Defaults to 0. * Query::HYDRATE_COLUMN. Defaults to 0.
* *
* @return array * @return array
*/ */
public function fetchAll($fetchStyle = Doctrine::FETCH_BOTH); public function fetchAll($fetchStyle = Query::HYDRATE_BOTH);
/** /**
* fetchColumn * fetchColumn
...@@ -209,7 +209,7 @@ interface Statement ...@@ -209,7 +209,7 @@ interface Statement
* Fetches the next row and returns it as an object. * Fetches the next row and returns it as an object.
* *
* Fetches the next row and returns it as an object. This function is an alternative to * Fetches the next row and returns it as an object. This function is an alternative to
* Doctrine_Adapter_Statement_Interface->fetch() with Doctrine::FETCH_CLASS or Doctrine::FETCH_OBJ style. * Doctrine_Adapter_Statement_Interface->fetch() with Query::HYDRATE_CLASS or Query::HYDRATE_OBJ style.
* *
* @param string $className Name of the created class, defaults to stdClass. * @param string $className Name of the created class, defaults to stdClass.
* @param array $args Elements of this array are passed to the constructor. * @param array $args Elements of this array are passed to the constructor.
...@@ -288,7 +288,7 @@ interface Statement ...@@ -288,7 +288,7 @@ interface Statement
* setFetchMode * setFetchMode
* Set the default fetch mode for this statement * Set the default fetch mode for this statement
* *
* @param integer $mode The fetch mode must be one of the Doctrine::FETCH_* constants. * @param integer $mode The fetch mode must be one of the Query::HYDRATE_* constants.
* @return boolean Returns 1 on success or FALSE on failure. * @return boolean Returns 1 on success or FALSE on failure.
*/ */
public function setFetchMode($mode, $arg1); public function setFetchMode($mode, $arg1);
......
...@@ -88,7 +88,7 @@ class Statement ...@@ -88,7 +88,7 @@ class Statement
* the case of the column, as returned by the driver. * the case of the column, as returned by the driver.
* *
* @param string $param Name of the PHP variable to which the column will be bound. * @param string $param Name of the PHP variable to which the column will be bound.
* @param integer $type Data type of the parameter, specified by the Doctrine::PARAM_* constants. * @param integer $type Data type of the parameter, specified by the PDO::PARAM_* constants.
* @return boolean Returns TRUE on success or FALSE on failure * @return boolean Returns TRUE on success or FALSE on failure
*/ */
public function bindColumn($column, $param, $type = null) public function bindColumn($column, $param, $type = null)
...@@ -110,7 +110,7 @@ class Statement ...@@ -110,7 +110,7 @@ class Statement
* using question mark placeholders, this will be the 1-indexed position of the parameter * using question mark placeholders, this will be the 1-indexed position of the parameter
* *
* @param mixed $value The value to bind to the parameter. * @param mixed $value The value to bind to the parameter.
* @param integer $type Explicit data type for the parameter using the Doctrine::PARAM_* constants. * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants.
* *
* @return boolean Returns TRUE on success or FALSE on failure. * @return boolean Returns TRUE on success or FALSE on failure.
*/ */
...@@ -140,9 +140,9 @@ class Statement ...@@ -140,9 +140,9 @@ class Statement
* *
* @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter. * @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
* *
* @param integer $type Explicit data type for the parameter using the Doctrine::PARAM_* constants. To return * @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants. To return
* an INOUT parameter from a stored procedure, use the bitwise OR operator to set the * an INOUT parameter from a stored procedure, use the bitwise OR operator to set the
* Doctrine::PARAM_INPUT_OUTPUT bits for the data_type parameter. * PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter.
* *
* @param integer $length Length of the data type. To indicate that a parameter is an OUT parameter * @param integer $length Length of the data type. To indicate that a parameter is an OUT parameter
* from a stored procedure, you must explicitly set the length. * from a stored procedure, you must explicitly set the length.
...@@ -241,32 +241,32 @@ class Statement ...@@ -241,32 +241,32 @@ class Statement
/** /**
* fetch * fetch
* *
* @see Doctrine::FETCH_* constants * @see Query::HYDRATE_* constants
* @param integer $fetchStyle Controls how the next row will be returned to the caller. * @param integer $fetchStyle Controls how the next row will be returned to the caller.
* This value must be one of the Doctrine::FETCH_* constants, * This value must be one of the Query::HYDRATE_* constants,
* defaulting to Doctrine::FETCH_BOTH * defaulting to Query::HYDRATE_BOTH
* *
* @param integer $cursorOrientation For a PDOStatement object representing a scrollable cursor, * @param integer $cursorOrientation For a PDOStatement object representing a scrollable cursor,
* this value determines which row will be returned to the caller. * this value determines which row will be returned to the caller.
* This value must be one of the Doctrine::FETCH_ORI_* constants, defaulting to * This value must be one of the Query::HYDRATE_ORI_* constants, defaulting to
* Doctrine::FETCH_ORI_NEXT. To request a scrollable cursor for your * Query::HYDRATE_ORI_NEXT. To request a scrollable cursor for your
* Doctrine_Adapter_Statement_Interface object, * Doctrine_Adapter_Statement_Interface object,
* you must set the Doctrine::ATTR_CURSOR attribute to Doctrine::CURSOR_SCROLL when you * you must set the PDO::ATTR_CURSOR attribute to Doctrine::CURSOR_SCROLL when you
* prepare the SQL statement with Doctrine_Adapter_Interface->prepare(). * prepare the SQL statement with Doctrine_Adapter_Interface->prepare().
* *
* @param integer $cursorOffset For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for which the * @param integer $cursorOffset For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for which the
* $cursorOrientation parameter is set to Doctrine::FETCH_ORI_ABS, this value specifies * $cursorOrientation parameter is set to Query::HYDRATE_ORI_ABS, this value specifies
* the absolute number of the row in the result set that shall be fetched. * the absolute number of the row in the result set that shall be fetched.
* *
* For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for * For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for
* which the $cursorOrientation parameter is set to Doctrine::FETCH_ORI_REL, this value * which the $cursorOrientation parameter is set to Query::HYDRATE_ORI_REL, this value
* specifies the row to fetch relative to the cursor position before * specifies the row to fetch relative to the cursor position before
* Doctrine_Adapter_Statement_Interface->fetch() was called. * Doctrine_Adapter_Statement_Interface->fetch() was called.
* *
* @return mixed * @return mixed
*/ */
public function fetch($fetchMode = Doctrine::FETCH_BOTH, public function fetch($fetchMode = Query::HYDRATE_BOTH,
$cursorOrientation = Doctrine::FETCH_ORI_NEXT, $cursorOrientation = Query::HYDRATE_ORI_NEXT,
$cursorOffset = null) $cursorOffset = null)
{ {
//$event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCH, $this->getQuery()); //$event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCH, $this->getQuery());
...@@ -289,15 +289,15 @@ class Statement ...@@ -289,15 +289,15 @@ class Statement
* Returns an array containing all of the result set rows * Returns an array containing all of the result set rows
* *
* @param integer $fetchMode Controls how the next row will be returned to the caller. * @param integer $fetchMode Controls how the next row will be returned to the caller.
* This value must be one of the Doctrine::FETCH_* constants, * This value must be one of the Query::HYDRATE_* constants,
* defaulting to Doctrine::FETCH_BOTH * defaulting to Query::HYDRATE_BOTH
* *
* @param integer $columnIndex Returns the indicated 0-indexed column when the value of $fetchStyle is * @param integer $columnIndex Returns the indicated 0-indexed column when the value of $fetchStyle is
* Doctrine::FETCH_COLUMN. Defaults to 0. * Query::HYDRATE_COLUMN. Defaults to 0.
* *
* @return array * @return array
*/ */
public function fetchAll($fetchMode = Doctrine::FETCH_BOTH, $columnIndex = null) public function fetchAll($fetchMode = Query::HYDRATE_BOTH, $columnIndex = null)
{ {
//$event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCHALL, $this->getQuery()); //$event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCHALL, $this->getQuery());
//$event->fetchMode = $fetchMode; //$event->fetchMode = $fetchMode;
...@@ -337,7 +337,7 @@ class Statement ...@@ -337,7 +337,7 @@ class Statement
* Fetches the next row and returns it as an object. * Fetches the next row and returns it as an object.
* *
* Fetches the next row and returns it as an object. This function is an alternative to * Fetches the next row and returns it as an object. This function is an alternative to
* Doctrine_Adapter_Statement_Interface->fetch() with Doctrine::FETCH_CLASS or Doctrine::FETCH_OBJ style. * Doctrine_Adapter_Statement_Interface->fetch() with Query::HYDRATE_CLASS or Query::HYDRATE_OBJ style.
* *
* @param string $className Name of the created class, defaults to stdClass. * @param string $className Name of the created class, defaults to stdClass.
* @param array $args Elements of this array are passed to the constructor. * @param array $args Elements of this array are passed to the constructor.
...@@ -428,7 +428,7 @@ class Statement ...@@ -428,7 +428,7 @@ class Statement
/** /**
* Set the default fetch mode for this statement * Set the default fetch mode for this statement
* *
* @param integer $mode The fetch mode must be one of the Doctrine::FETCH_* constants. * @param integer $mode The fetch mode must be one of the Query::HYDRATE_* constants.
* @return boolean Returns 1 on success or FALSE on failure. * @return boolean Returns 1 on success or FALSE on failure.
*/ */
public function setFetchMode($mode, $arg1 = null, $arg2 = null) public function setFetchMode($mode, $arg1 = null, $arg2 = null)
......
This diff is collapsed.
...@@ -149,7 +149,7 @@ class EntityRepository ...@@ -149,7 +149,7 @@ class EntityRepository
* *
* @param string $dql DQL after WHERE clause * @param string $dql DQL after WHERE clause
* @param array $params query parameters * @param array $params query parameters
* @param int $hydrationMode Doctrine::FETCH_ARRAY or Doctrine::FETCH_RECORD * @param int $hydrationMode Query::HYDRATE_ARRAY or Query::HYDRATE_RECORD
* @return Doctrine_Collection * @return Doctrine_Collection
* *
* @todo This actually takes DQL, not SQL, but it requires column names * @todo This actually takes DQL, not SQL, but it requires column names
...@@ -167,7 +167,7 @@ class EntityRepository ...@@ -167,7 +167,7 @@ class EntityRepository
* *
* @param string $dql DQL after WHERE clause * @param string $dql DQL after WHERE clause
* @param array $params query parameters * @param array $params query parameters
* @param int $hydrationMode Doctrine::FETCH_ARRAY or Doctrine::FETCH_RECORD * @param int $hydrationMode Query::HYDRATE_ARRAY or Query::HYDRATE_RECORD
* @return Doctrine_Collection * @return Doctrine_Collection
*/ */
public function findByDql($dql, array $params = array(), $hydrationMode = null) public function findByDql($dql, array $params = array(), $hydrationMode = null)
......
...@@ -63,7 +63,7 @@ class Query extends AbstractQuery ...@@ -63,7 +63,7 @@ class Query extends AbstractQuery
/** /**
* @var Doctrine\ORM\EntityManager The entity manager used by this query object. * @var Doctrine\ORM\EntityManager The entity manager used by this query object.
*/ */
protected $_entityManager; protected $_em;
/** /**
* @var integer The hydration mode. * @var integer The hydration mode.
...@@ -125,7 +125,7 @@ class Query extends AbstractQuery ...@@ -125,7 +125,7 @@ class Query extends AbstractQuery
*/ */
public function __construct(EntityManager $entityManager) public function __construct(EntityManager $entityManager)
{ {
$this->_entityManager = $entityManager; $this->_em = $entityManager;
$this->free(); $this->free();
} }
...@@ -136,7 +136,7 @@ class Query extends AbstractQuery ...@@ -136,7 +136,7 @@ class Query extends AbstractQuery
*/ */
public function getEntityManager() public function getEntityManager()
{ {
return $this->_entityManager; return $this->_em;
} }
/** /**
...@@ -222,7 +222,7 @@ class Query extends AbstractQuery ...@@ -222,7 +222,7 @@ class Query extends AbstractQuery
* *
* @param string $params Parameters to be sent to query. * @param string $params Parameters to be sent to query.
* @param integer $hydrationMode Doctrine processing mode to be used during hydration process. * @param integer $hydrationMode Doctrine processing mode to be used during hydration process.
* One of the Doctrine::HYDRATE_* constants. * One of the Query::HYDRATE_* constants.
* @return mixed * @return mixed
*/ */
public function execute($params = array(), $hydrationMode = null) public function execute($params = array(), $hydrationMode = null)
...@@ -274,7 +274,7 @@ class Query extends AbstractQuery ...@@ -274,7 +274,7 @@ class Query extends AbstractQuery
protected function _execute(array $params) protected function _execute(array $params)
{ {
// If there is a CacheDriver associated to cache queries... // If there is a CacheDriver associated to cache queries...
if ($this->_queryCache || $this->_entityManager->getConnection()->getAttribute(Doctrine::ATTR_QUERY_CACHE)) { if ($this->_queryCache || $this->_em->getConfiguration()->getQueryCacheImpl()) {
$queryCacheDriver = $this->getQueryCacheDriver(); $queryCacheDriver = $this->getQueryCacheDriver();
// Calculate hash for dql query. // Calculate hash for dql query.
...@@ -303,13 +303,6 @@ class Query extends AbstractQuery ...@@ -303,13 +303,6 @@ class Query extends AbstractQuery
// Converting parameters // Converting parameters
$params = $this->_prepareParams($params); $params = $this->_prepareParams($params);
// Double the params if we are using limit-subquery algorithm
// We always have an instance of Doctrine_ORM_Query_ParserResult on hands...
/*if ($this->_parserResult->isLimitSubqueryUsed() &&
$this->_entityManager->getConnection()->getAttribute(Doctrine::ATTR_DRIVER_NAME) !== 'mysql') {
$params = array_merge($params, $params);
}*/
// Executing the query and returning statement // Executing the query and returning statement
return $executor->execute($this->_conn, $params); return $executor->execute($this->_conn, $params);
} }
...@@ -320,7 +313,7 @@ class Query extends AbstractQuery ...@@ -320,7 +313,7 @@ class Query extends AbstractQuery
protected function _prepareParams(array $params) protected function _prepareParams(array $params)
{ {
// Convert boolean params // Convert boolean params
$params = $this->_entityManager->getConnection()->convertBooleans($params); $params = $this->_em->getConnection()->convertBooleans($params);
// Convert enum params // Convert enum params
return $this->convertEnums($params); return $this->convertEnums($params);
...@@ -354,7 +347,7 @@ class Query extends AbstractQuery ...@@ -354,7 +347,7 @@ class Query extends AbstractQuery
if ($this->_resultCache instanceof \Doctrine\ORM\Cache\Cache) { if ($this->_resultCache instanceof \Doctrine\ORM\Cache\Cache) {
return $this->_resultCache; return $this->_resultCache;
} else { } else {
return $this->_entityManager->getConnection()->getResultCacheDriver(); return $this->_em->getConnection()->getResultCacheDriver();
} }
} }
...@@ -437,7 +430,7 @@ class Query extends AbstractQuery ...@@ -437,7 +430,7 @@ class Query extends AbstractQuery
if ($this->_queryCache instanceof \Doctrine\ORM\Cache\Cache) { if ($this->_queryCache instanceof \Doctrine\ORM\Cache\Cache) {
return $this->_queryCache; return $this->_queryCache;
} else { } else {
return $this->_entityManager->getConnection()->getQueryCacheDriver(); return $this->_em->getConnection()->getQueryCacheDriver();
} }
} }
...@@ -495,7 +488,7 @@ class Query extends AbstractQuery ...@@ -495,7 +488,7 @@ class Query extends AbstractQuery
* Defines the processing mode to be used during hydration process. * Defines the processing mode to be used during hydration process.
* *
* @param integer $hydrationMode Doctrine processing mode to be used during hydration process. * @param integer $hydrationMode Doctrine processing mode to be used during hydration process.
* One of the Doctrine::HYDRATE_* constants. * One of the Query::HYDRATE_* constants.
* @return Doctrine\ORM\Query * @return Doctrine\ORM\Query
*/ */
public function setHydrationMode($hydrationMode) public function setHydrationMode($hydrationMode)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment