Commit dea4968a authored by subzero2000's avatar subzero2000

Completes deprecation of Doctrine_Db. Fixes #362.

parent fb46481a
......@@ -150,7 +150,7 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable
{ }
public function getAttribute($attribute)
{
if($attribute == PDO::ATTR_DRIVER_NAME)
if($attribute == Doctrine::ATTR_DRIVER_NAME)
return strtolower($this->name);
}
public function setAttribute($attribute, $value)
......
......@@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
*/
Doctrine::autoload('Doctrine_Db_EventListener');
Doctrine::autoload('Doctrine_EventListener');
/**
* Doctrine_Cache
*
......@@ -31,7 +31,7 @@ Doctrine::autoload('Doctrine_Db_EventListener');
* @since 1.0
* @version $Revision$
*/
class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, IteratorAggregate
class Doctrine_Cache extends Doctrine_EventListener implements Countable, IteratorAggregate
{
/**
* @var array $_options an array of general caching options
......@@ -281,14 +281,14 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
}
/**
* onPreQuery
* listens the onPreQuery event of Doctrine_Db
* listens on the Doctrine_Event onPreQuery event
*
* adds the issued query to internal query stack
* and checks if cached element exists
*
* @return boolean
*/
public function onPreQuery(Doctrine_Db_Event $event)
public function onPreQuery(Doctrine_Event $event)
{
$query = $event->getQuery();
......@@ -325,14 +325,14 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
}
/**
* onPreFetch
* listens the onPreFetch event of Doctrine_Db_Statement
* listens the onPreFetch event of Doctrine_Connection_Statement
*
* advances the internal pointer of cached data and returns
* the current element
*
* @return array
*/
public function onPreFetch(Doctrine_Db_Event $event)
public function onPreFetch(Doctrine_Event $event)
{
$ret = current($this->_data);
next($this->_data);
......@@ -340,26 +340,26 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
}
/**
* onPreFetch
* listens the onPreFetchAll event of Doctrine_Db_Statement
* listens the onPreFetchAll event of Doctrine_Connection_Statement
*
* returns the current cache data array
*
* @return array
*/
public function onPreFetchAll(Doctrine_Db_Event $event)
public function onPreFetchAll(Doctrine_Event $event)
{
return $this->_data;
}
/**
* onPreExecute
* listens the onPreExecute event of Doctrine_Db_Statement
* listens the onPreExecute event of Doctrine_Connection_Statement
*
* adds the issued query to internal query stack
* and checks if cached element exists
*
* @return boolean
*/
public function onPreExecute(Doctrine_Db_Event $event)
public function onPreExecute(Doctrine_Event $event)
{
$query = $event->getQuery();
......
......@@ -169,8 +169,10 @@ abstract class Doctrine_Configurable
/**
* addListener
*
* @param Doctrine_Db_EventListener_Interface|Doctrine_Overloadable $listener
* @return Doctrine_Db
* @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener
* @return Doctrine_Connection_Informix|Doctrine_Connection_Mssql|Doctrine_Connection_Oracle|
* Doctrine_Connection_Db2|Doctrine_Connection_Firebird|Doctrine_Connection_Common|
* Doctrine_Manager|Doctrine_Connection|Doctrine_Table
*/
public function addListener($listener, $name = null)
{
......@@ -186,7 +188,7 @@ abstract class Doctrine_Configurable
/**
* getListener
*
* @return Doctrine_Db_EventListener_Interface|Doctrine_Overloadable
* @return Doctrine_EventListener_Interface|Doctrine_Overloadable
*/
public function getListener()
{
......@@ -201,8 +203,10 @@ abstract class Doctrine_Configurable
/**
* setListener
*
* @param Doctrine_Db_EventListener_Interface|Doctrine_Overloadable $listener
* @return Doctrine_Db
* @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener
* @return Doctrine_Connection_Informix|Doctrine_Connection_Mssql|Doctrine_Connection_Oracle|
* Doctrine_Connection_Db2|Doctrine_Connection_Firebird|Doctrine_Connection_Common|
* Doctrine_Manager|Doctrine_Connection|Doctrine_Table
*/
public function setListener($listener)
{
......
......@@ -66,11 +66,11 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
/**
* method overloader
* this method is used for invoking different listeners, for the full
* list of availible listeners, see Doctrine_Db_EventListener
* list of availible listeners, see Doctrine_EventListener
*
* @param string $m the name of the method
* @param array $a method arguments
* @see Doctrine_Db_EventListener
* @see Doctrine_EventListener
* @return boolean
*/
public function __call($m, $a)
......@@ -150,17 +150,17 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg
/**
* pop the last event from the event stack
*
* @return Doctrine_Db_Event
* @return Doctrine_Event
*/
public function pop()
{
return array_pop($this->events);
}
/**
* Get the Doctrine_Db_Event object for the last query that was run, regardless if it has
* Get the Doctrine_Event object for the last query that was run, regardless if it has
* ended or not. If the event has not ended, it's end time will be Null.
*
* @return Doctrine_Db_Event
* @return Doctrine_Event
*/
public function lastEvent()
{
......
......@@ -257,7 +257,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
$cursorOrientation = Doctrine::FETCH_ORI_NEXT,
$cursorOffset = null)
{
$event = new Doctrine_Db_Event($this, Doctrine_Event::STMT_FETCH, $this->_stmt->getQuery());
$event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCH, $this->_stmt->getQuery());
$event->fetchMode = $fetchMode;
$event->cursorOrientation = $cursorOrientation;
......@@ -289,7 +289,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
public function fetchAll($fetchMode = Doctrine::FETCH_BOTH,
$columnIndex = null)
{
$event = new Doctrine_Db_Event($this, Doctrine_Event::STMT_FETCHALL, $this->_stmt->getQuery());
$event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCHALL, $this->_stmt->getQuery());
$event->fetchMode = $fetchMode;
$event->columnIndex = $columnIndex;
......
......@@ -33,6 +33,6 @@ class Doctrine_Db
{
public function __construct()
{
throw new Exception('Doctrine_Db has been deprecated. The functionality has been merged into Doctrine_Connection.');
throw new Doctrine_Exception('Doctrine_Db has been deprecated. The functionality has been merged into Doctrine_Connection.');
}
}
......@@ -91,9 +91,10 @@ class Doctrine_Event
/**
* constructor
*
* @param Doctrine_Db $invoker the handler which invoked this event
* @param integer $code the event code
* @param string $query the sql query associated with this event (if any)
* @param Doctrine_Connection|Doctrine_Connection_Statement|
Doctrine_Connection_UnitOfWork|Doctrine_Transaction $invoker the handler which invoked this event
* @param integer $code the event code
* @param string $query the sql query associated with this event (if any)
*/
public function __construct($invoker, $code, $query = null, $params = array())
{
......@@ -225,7 +226,8 @@ class Doctrine_Event
* getInvoker
* returns the handler that invoked this event
*
* @return Doctrine_Db the handler that invoked this event
* @return Doctrine_Connection|Doctrine_Connection_Statement|
* Doctrine_Connection_UnitOfWork|Doctrine_Transaction the handler that invoked this event
*/
public function getInvoker()
{
......
......@@ -653,7 +653,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
if ($this->isLimitSubqueryUsed() &&
$this->_conn->getDBH()->getAttribute(Doctrine::ATTR_DRIVER_NAME) !== 'mysql') {
$this->_conn->getAttribute(Doctrine::ATTR_DRIVER_NAME) !== 'mysql') {
$params = array_merge($params, $params);
}
......
......@@ -190,7 +190,7 @@ class Doctrine_Lib
$r[] = 'State : ' . Doctrine_Lib::getConnectionStateAsString($connection->transaction->getState());
$r[] = 'Open Transactions : ' . $connection->transaction->getTransactionLevel();
$r[] = 'Table in memory : ' . $connection->count();
$r[] = 'Driver name : ' . $connection->getDbh()->getAttribute(Doctrine::ATTR_DRIVER_NAME);
$r[] = 'Driver name : ' . $connection->getAttribute(Doctrine::ATTR_DRIVER_NAME);
$r[] = "</pre>";
return implode("\n",$r)."<br>";
......
......@@ -211,10 +211,6 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
if ( ! ($adapter instanceof PDO) && ! in_array('Doctrine_Adapter_Interface', class_implements($adapter))) {
throw new Doctrine_Manager_Exception("First argument should be an instance of PDO or implement Doctrine_Adapter_Interface");
}
if ($adapter instanceof Doctrine_Db) {
$adapter->setName($name);
}
$driverName = $adapter->getAttribute(Doctrine::ATTR_DRIVER_NAME);
} elseif (is_array($adapter)) {
......
......@@ -840,7 +840,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
// initialize the base of the subquery
$subquery = 'SELECT DISTINCT ' . $primaryKey;
if ($this->_conn->getDBH()->getAttribute(PDO::ATTR_DRIVER_NAME) == 'pgsql') {
if ($this->_conn->getAttribute(Doctrine::ATTR_DRIVER_NAME) == 'pgsql') {
// pgsql needs the order by fields to be preserved in select clause
foreach ($this->parts['orderby'] as $part) {
......
......@@ -1548,8 +1548,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
/**
* addListener
*
* @param Doctrine_Db_EventListener_Interface|Doctrine_Overloadable $listener
* @return Doctrine_Db
* @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener
* @return Doctrine_Record
*/
public function addListener($listener, $name = null)
{
......@@ -1559,7 +1559,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
/**
* getListener
*
* @return Doctrine_Db_EventListener_Interface|Doctrine_Overloadable
* @return Doctrine_EventListener_Interface|Doctrine_Overloadable
*/
public function getListener()
{
......@@ -1568,8 +1568,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
/**
* setListener
*
* @param Doctrine_Db_EventListener_Interface|Doctrine_Overloadable $listener
* @return Doctrine_Db
* @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener
* @return Doctrine_Record
*/
public function setListener($listener)
{
......
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