Commit 22e94ac5 authored by romanb's avatar romanb

Enabling namespaces. Final restructurings.

parent 4ab2ba7d
<?php <?php
namespace Doctrine\Common;
/** /**
* A class loader used to load class files on demand. * A class loader used to load class files on demand.
* *
...@@ -17,9 +20,9 @@ ...@@ -17,9 +20,9 @@
* @since 2.0 * @since 2.0
* @author romanb <roman@code-factory.org> * @author romanb <roman@code-factory.org>
*/ */
class Doctrine_Common_ClassLoader class ClassLoader
{ {
private $_namespaceSeparator = '_'; private $_namespaceSeparator = '\\';
private $_fileExtension = '.php'; private $_fileExtension = '.php';
private $_checkFileExists = false; private $_checkFileExists = false;
private $_basePaths = array(); private $_basePaths = array();
...@@ -71,7 +74,10 @@ class Doctrine_Common_ClassLoader ...@@ -71,7 +74,10 @@ class Doctrine_Common_ClassLoader
if (isset($this->_basePaths[$prefix])) { if (isset($this->_basePaths[$prefix])) {
$class .= $this->_basePaths[$prefix] . DIRECTORY_SEPARATOR; $class .= $this->_basePaths[$prefix] . DIRECTORY_SEPARATOR;
} }
$class .= str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $className)
if ($className[0] == '\\') $className = substr($className, 1);
$class .= str_replace(array($this->_namespaceSeparator, '_'), DIRECTORY_SEPARATOR, $className)
. $this->_fileExtension; . $this->_fileExtension;
if ($this->_checkFileExists) { if ($this->_checkFileExists) {
...@@ -81,6 +87,21 @@ class Doctrine_Common_ClassLoader ...@@ -81,6 +87,21 @@ class Doctrine_Common_ClassLoader
@fclose($fh); @fclose($fh);
} }
if ($class == 'ForumAvatar.php' || $class == 'ForumUser.php') {
echo $class . PHP_EOL;
try {
throw new \Exception();
} catch (\Exception $e) {
echo $e->getTraceAsString();
}
} else if ($class == 'Doctrine/Common/Exceptions/DoctrineException.php') {
try {
throw new \Exception();
} catch (\Exception $e) {
echo $e->getTraceAsString();
}
}
require $class; require $class;
return true; return true;
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
#namespace Doctrine\Common\Collections; namespace Doctrine\Common\Collections;
#use \Countable; use \Countable;
#use \IteratorAggregate; use \IteratorAggregate;
#use \ArrayAccess; use \ArrayAccess;
/** /**
* A Collection is a wrapper around a php array and just like a php array a * A Collection is a wrapper around a php array and just like a php array a
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* *
* @author robo * @author robo
*/ */
class Doctrine_Common_Collections_Collection implements Countable, IteratorAggregate, ArrayAccess class Collection implements Countable, IteratorAggregate, ArrayAccess
{ {
/** /**
* An array containing the entries of this collection. * An array containing the entries of this collection.
...@@ -323,7 +323,7 @@ class Doctrine_Common_Collections_Collection implements Countable, IteratorAggre ...@@ -323,7 +323,7 @@ class Doctrine_Common_Collections_Collection implements Countable, IteratorAggre
*/ */
public function map(Closure $func) public function map(Closure $func)
{ {
return new Doctrine_Common_Collections_Collection(array_map($func, $this->_data)); return new Collection(array_map($func, $this->_data));
} }
/** /**
...@@ -334,7 +334,7 @@ class Doctrine_Common_Collections_Collection implements Countable, IteratorAggre ...@@ -334,7 +334,7 @@ class Doctrine_Common_Collections_Collection implements Countable, IteratorAggre
*/ */
public function filter(Closure $func) public function filter(Closure $func)
{ {
return new Doctrine_Common_Collections_Collection(array_filter($this->_data, $func)); return new Collection(array_filter($this->_data, $func));
} }
/** /**
......
<?php <?php
class Doctrine_Common_Exceptions_DoctrineException extends Exception namespace Doctrine\Common;
class DoctrineException extends \Exception
{ {
private $_innerException; private $_innerException;
...@@ -21,4 +23,3 @@ class Doctrine_Common_Exceptions_DoctrineException extends Exception ...@@ -21,4 +23,3 @@ class Doctrine_Common_Exceptions_DoctrineException extends Exception
} }
} }
?>
\ No newline at end of file
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\Common; namespace Doctrine\Common;
use Doctrine\Common\Events\Event;
/** /**
* The EventManager is the central point of Doctrine's event listener system. * The EventManager is the central point of Doctrine's event listener system.
...@@ -30,7 +32,7 @@ ...@@ -30,7 +32,7 @@
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @since 2.0 * @since 2.0
*/ */
class Doctrine_Common_EventManager class EventManager
{ {
/** /**
* Map of registered listeners. * Map of registered listeners.
...@@ -52,7 +54,7 @@ class Doctrine_Common_EventManager ...@@ -52,7 +54,7 @@ class Doctrine_Common_EventManager
$callback = $argIsCallback ? $event : $event->getType(); $callback = $argIsCallback ? $event : $event->getType();
if (isset($this->_listeners[$callback])) { if (isset($this->_listeners[$callback])) {
$event = $argIsCallback ? new Doctrine_Event($event) : $event; $event = $argIsCallback ? new Event($event) : $event;
foreach ($this->_listeners[$callback] as $listener) { foreach ($this->_listeners[$callback] as $listener) {
$listener->$callback($event); $listener->$callback($event);
} }
...@@ -103,10 +105,9 @@ class Doctrine_Common_EventManager ...@@ -103,10 +105,9 @@ class Doctrine_Common_EventManager
* *
* @param Doctrine\Common\EventSubscriber $subscriber The subscriber. * @param Doctrine\Common\EventSubscriber $subscriber The subscriber.
*/ */
public function addEventSubscriber(Doctrine_Common_EventSubscriber $subscriber) public function addEventSubscriber(EventSubscriber $subscriber)
{ {
$this->addEventListener($subscriber->getSubscribedEvents(), $subscriber); $this->addEventListener($subscriber->getSubscribedEvents(), $subscriber);
} }
} }
?>
\ No newline at end of file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine::Common; namespace Doctrine\Common;
/** /**
* An EventSubscriber knows himself what events he is interested in. * An EventSubscriber knows himself what events he is interested in.
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* @since 2.0 * @since 2.0
* @version $Revision: 4653 $ * @version $Revision: 4653 $
*/ */
interface Doctrine_Common_EventSubscriber interface EventSubscriber
{ {
public function getSubscribedEvents(); public function getSubscribedEvents();
} }
...@@ -19,20 +19,18 @@ ...@@ -19,20 +19,18 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\Common\Events; namespace Doctrine\Common\Events;
/** /**
* Doctrine_Event * Doctrine_Event
* *
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @package Doctrine
* @subpackage Event
* @link www.phpdoctrine.org * @link www.phpdoctrine.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_Common_Events_Event class Event
{ {
/* Event callback constants */ /* Event callback constants */
const preDelete = 'preDelete'; const preDelete = 'preDelete';
......
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\DBAL; namespace Doctrine\DBAL;
use Doctrine\DBAL\Types\Type;
/** /**
* Configuration container for the Doctrine DBAL. * Configuration container for the Doctrine DBAL.
...@@ -30,7 +32,7 @@ ...@@ -30,7 +32,7 @@
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Configuration class Configuration
{ {
/** /**
* The attributes that are contained in the configuration. * The attributes that are contained in the configuration.
...@@ -99,14 +101,14 @@ class Doctrine_DBAL_Configuration ...@@ -99,14 +101,14 @@ class Doctrine_DBAL_Configuration
public function setCustomTypes(array $types) public function setCustomTypes(array $types)
{ {
foreach ($types as $name => $typeClassName) { foreach ($types as $name => $typeClassName) {
Doctrine_DBAL_Types_Type::addCustomType($name, $typeClassName); Type::addCustomType($name, $typeClassName);
} }
} }
public function setTypeOverrides(array $overrides) public function setTypeOverrides(array $overrides)
{ {
foreach ($override as $name => $typeClassName) { foreach ($override as $name => $typeClassName) {
Doctrine_DBAL_Types_Type::overrideType($name, $typeClassName); Type::overrideType($name, $typeClassName);
} }
} }
} }
\ No newline at end of file
...@@ -19,9 +19,10 @@ ...@@ -19,9 +19,10 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\DBAL; namespace Doctrine\DBAL;
#use Doctrine\Common\EventManager; use Doctrine\Common\EventManager;
use Doctrine\Common\DoctrineException;
#use Doctrine\DBAL\Exceptions\ConnectionException; #use Doctrine\DBAL\Exceptions\ConnectionException;
/** /**
...@@ -53,7 +54,7 @@ ...@@ -53,7 +54,7 @@
* Doctrine\DBAL could ship with a simple standard broker that uses a primitive * Doctrine\DBAL could ship with a simple standard broker that uses a primitive
* round-robin approach to distribution. User can provide its own brokers. * round-robin approach to distribution. User can provide its own brokers.
*/ */
class Doctrine_DBAL_Connection class Connection
{ {
/** /**
* Constant for transaction isolation level READ UNCOMMITTED. * Constant for transaction isolation level READ UNCOMMITTED.
...@@ -155,9 +156,9 @@ class Doctrine_DBAL_Connection ...@@ -155,9 +156,9 @@ class Doctrine_DBAL_Connection
* *
* @param array $params The connection parameters. * @param array $params The connection parameters.
*/ */
public function __construct(array $params, Doctrine_DBAL_Driver $driver, public function __construct(array $params, Driver $driver,
Doctrine_DBAL_Configuration $config = null, Configuration $config = null,
Doctrine_Common_EventManager $eventManager = null) EventManager $eventManager = null)
{ {
$this->_driver = $driver; $this->_driver = $driver;
$this->_params = $params; $this->_params = $params;
...@@ -169,10 +170,10 @@ class Doctrine_DBAL_Connection ...@@ -169,10 +170,10 @@ class Doctrine_DBAL_Connection
// Create default config and event manager if none given // Create default config and event manager if none given
if ( ! $config) { if ( ! $config) {
$this->_config = new Doctrine_DBAL_Configuration(); $this->_config = new Configuration();
} }
if ( ! $eventManager) { if ( ! $eventManager) {
$this->_eventManager = new Doctrine_Common_EventManager(); $this->_eventManager = new EventManager();
} }
$this->_platform = $driver->getDatabasePlatform(); $this->_platform = $driver->getDatabasePlatform();
...@@ -702,7 +703,7 @@ class Doctrine_DBAL_Connection ...@@ -702,7 +703,7 @@ class Doctrine_DBAL_Connection
public function commit() public function commit()
{ {
if ($this->_transactionNestingLevel == 0) { if ($this->_transactionNestingLevel == 0) {
throw new Doctrine_Exception("Commit failed. There is no active transaction."); throw new DoctrineException("Commit failed. There is no active transaction.");
} }
$this->connect(); $this->connect();
......
<?php <?php
namespace Doctrine\DBAL;
/** /**
* Driver interface. * Driver interface.
* Interface that all DBAL drivers must implement. * Interface that all DBAL drivers must implement.
* *
* @since 2.0 * @since 2.0
*/ */
interface Doctrine_DBAL_Driver interface Driver
{ {
/** /**
* Attempts to create a connection with the database. * Attempts to create a connection with the database.
...@@ -32,7 +35,6 @@ interface Doctrine_DBAL_Driver ...@@ -32,7 +35,6 @@ interface Doctrine_DBAL_Driver
* *
* @return Doctrine\DBAL\SchemaManager * @return Doctrine\DBAL\SchemaManager
*/ */
public function getSchemaManager(Doctrine_DBAL_Connection $conn); public function getSchemaManager(Connection $conn);
} }
?>
\ No newline at end of file
<?php <?php
namespace Doctrine\DBAL\Driver;
/** /**
* Connection interface. * Connection interface.
* Drivers must implement this interface. * Drivers must implement this interface.
...@@ -8,7 +10,7 @@ ...@@ -8,7 +10,7 @@
* *
* @since 2.0 * @since 2.0
*/ */
interface Doctrine_DBAL_Driver_Connection interface Connection
{ {
public function prepare($prepareString); public function prepare($prepareString);
public function query(); public function query();
......
<?php <?php
namespace Doctrine\DBAL\Driver;
use \PDO;
/** /**
* PDO implementation of the driver Connection interface. * PDO implementation of the driver Connection interface.
* Used by all PDO-based drivers. * Used by all PDO-based drivers.
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Driver_PDOConnection extends PDO implements Doctrine_DBAL_Driver_Connection class PDOConnection extends PDO implements \Doctrine\DBAL\Driver\Connection
{ {
public function __construct($dsn, $user = null, $password = null, array $options = null) public function __construct($dsn, $user = null, $password = null, array $options = null)
{ {
parent::__construct($dsn, $user, $password, $options); parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Doctrine_DBAL_Driver_PDOStatement', array())); $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Doctrine\DBAL\Driver\PDOStatement', array()));
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); $this->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
} }
......
<?php <?php
#namespace Doctrine::DBAL::Driver::PDOMsSql; namespace Doctrine\DBAL\Driver\PDOMsSql;
/** /**
* MsSql Connection implementation. * MsSql Connection implementation.
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Driver_PDOMsSql_Connection extends PDO implements Doctrine_DBAL_Driver_Connection class Connection extends PDO implements \Doctrine\DBAL\Driver\Connection
{ {
/** /**
* Performs the rollback. * Performs the rollback.
...@@ -40,4 +40,3 @@ class Doctrine_DBAL_Driver_PDOMsSql_Connection extends PDO implements Doctrine_D ...@@ -40,4 +40,3 @@ class Doctrine_DBAL_Driver_PDOMsSql_Connection extends PDO implements Doctrine_D
} }
} }
?>
\ No newline at end of file
<?php <?php
#namespace Doctrine::DBAL::Driver::PDOMySql; namespace Doctrine\DBAL\Driver\PDOMsSql;
#use Doctrine::DBAL::Driver; class Driver implements \Doctrine\DBAL\Driver
class Doctrine_DBAL_Driver_PDOMsSql_Driver implements Doctrine_DBAL_Driver
{ {
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{ {
return new Doctrine_DBAL_Driver_MsSql_Connection( return new Connection(
$this->_constructPdoDsn($params), $this->_constructPdoDsn($params),
$username, $username,
$password, $password,
...@@ -40,4 +38,3 @@ class Doctrine_DBAL_Driver_PDOMsSql_Driver implements Doctrine_DBAL_Driver ...@@ -40,4 +38,3 @@ class Doctrine_DBAL_Driver_PDOMsSql_Driver implements Doctrine_DBAL_Driver
} }
?>
\ No newline at end of file
<?php <?php
#namespace Doctrine::DBAL::Driver::PDOOracle; namespace Doctrine\DBAL\Driver\PDOOracle;
#use Doctrine::DBAL::Driver; class Driver implements \Doctrine\DBAL\Driver
class Doctrine_DBAL_Driver_PDOOracle_Driver implements Doctrine_DBAL_Driver
{ {
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{ {
return new Doctrine_DBAL_Driver_PDOConnection( return new \Doctrine\DBAL\Driver\PDOConnection(
$this->_constructPdoDsn($params), $this->_constructPdoDsn($params),
$username, $username,
$password, $password,
...@@ -28,14 +26,13 @@ class Doctrine_DBAL_Driver_PDOOracle_Driver implements Doctrine_DBAL_Driver ...@@ -28,14 +26,13 @@ class Doctrine_DBAL_Driver_PDOOracle_Driver implements Doctrine_DBAL_Driver
public function getDatabasePlatform() public function getDatabasePlatform()
{ {
return new Doctrine_DatabasePlatform_OraclePlatform(); return new \Doctrine\DBAL\Platforms\OraclePlatform();
} }
public function getSchemaManager(Doctrine_Connection $conn) public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
{ {
return new Doctrine_Schema_OracleSchemaManager($conn); return new \Doctrine\DBAL\Schema\OracleSchemaManager($conn);
} }
} }
?>
\ No newline at end of file
<?php <?php
#namespace Doctrine::DBAL::Driver::PDOOracle; namespace Doctrine\DBAL\Driver\PDOSqlite;
#use Doctrine::DBAL::Driver; #use Doctrine::DBAL::Driver;
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Driver_PDOSqlite_Driver implements Doctrine_DBAL_Driver class Driver implements \Doctrine\DBAL\Driver
{ {
/** /**
* Tries to establish a database connection to SQLite. * Tries to establish a database connection to SQLite.
...@@ -22,7 +22,7 @@ class Doctrine_DBAL_Driver_PDOSqlite_Driver implements Doctrine_DBAL_Driver ...@@ -22,7 +22,7 @@ class Doctrine_DBAL_Driver_PDOSqlite_Driver implements Doctrine_DBAL_Driver
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{ {
return new Doctrine_DBAL_Driver_PDOConnection( return new \Doctrine\DBAL\Driver\PDOConnection(
$this->_constructPdoDsn($params), $this->_constructPdoDsn($params),
$username, $username,
$password, $password,
...@@ -52,7 +52,7 @@ class Doctrine_DBAL_Driver_PDOSqlite_Driver implements Doctrine_DBAL_Driver ...@@ -52,7 +52,7 @@ class Doctrine_DBAL_Driver_PDOSqlite_Driver implements Doctrine_DBAL_Driver
*/ */
public function getDatabasePlatform() public function getDatabasePlatform()
{ {
return new Doctrine_DBAL_Platforms_SqlitePlatform(); return new \Doctrine\DBAL\Platforms\SqlitePlatform();
} }
/** /**
...@@ -61,9 +61,9 @@ class Doctrine_DBAL_Driver_PDOSqlite_Driver implements Doctrine_DBAL_Driver ...@@ -61,9 +61,9 @@ class Doctrine_DBAL_Driver_PDOSqlite_Driver implements Doctrine_DBAL_Driver
* @param Doctrine\DBAL\Connection $conn * @param Doctrine\DBAL\Connection $conn
* @return Doctrine\DBAL\Schema\SqliteSchemaManager * @return Doctrine\DBAL\Schema\SqliteSchemaManager
*/ */
public function getSchemaManager(Doctrine_DBAL_Connection $conn) public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
{ {
return new Doctrine_DBAL_Schema_SqliteSchemaManager($conn); return new \Doctrine\DBAL\Schema\SqliteSchemaManager($conn);
} }
} }
......
<?php <?php
class Doctrine_DBAL_Driver_PDOStatement extends PDOStatement implements Doctrine_DBAL_Driver_Statement namespace Doctrine\DBAL\Driver;
class PDOStatement extends \PDOStatement implements \Doctrine\DBAL\Driver\Statement
{ {
private function __construct() {} private function __construct() {}
} }
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\DBAL\Driver; namespace Doctrine\DBAL\Driver;
/** /**
* Statement interface. * Statement interface.
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision$
*/ */
interface Doctrine_DBAL_Driver_Statement interface Statement
{ {
/** /**
* Bind a column to a PHP variable * Bind a column to a PHP variable
......
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\DBAL; namespace Doctrine\DBAL;
use Doctrine\Common\EventManager;
/** /**
* Factory for creating Doctrine\DBAL\Connection instances. * Factory for creating Doctrine\DBAL\Connection instances.
...@@ -27,7 +29,7 @@ ...@@ -27,7 +29,7 @@
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @since 2.0 * @since 2.0
*/ */
final class Doctrine_DBAL_DriverManager final class DriverManager
{ {
/** /**
* List of supported drivers and their mappings to the driver class. * List of supported drivers and their mappings to the driver class.
...@@ -35,13 +37,13 @@ final class Doctrine_DBAL_DriverManager ...@@ -35,13 +37,13 @@ final class Doctrine_DBAL_DriverManager
* @var array * @var array
*/ */
private static $_driverMap = array( private static $_driverMap = array(
'pdo_mysql' => 'Doctrine_DBAL_Driver_PDOMySql_Driver', 'pdo_mysql' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
'pdo_sqlite' => 'Doctrine_DBAL_Driver_PDOSqlite_Driver', 'pdo_sqlite' => 'Doctrine\DBAL\Driver\PDOSqlite\Driver',
'pdo_pgsql' => 'Doctrine_DBAL_Driver_PDOPgSql_Driver', 'pdo_pgsql' => 'Doctrine\DBAL\Driver\PDOPgSql\Driver',
'pdo_oracle' => 'Doctrine_DBAL_Driver_PDOOracle_Driver', 'pdo_oracle' => 'Doctrine\DBAL\Driver\PDOOracle\Driver',
'pdo_mssql' => 'Doctrine_DBAL_Driver_PDOMsSql_Driver', 'pdo_mssql' => 'Doctrine\DBAL\Driver\PDOMsSql\Driver',
'pdo_firebird' => 'Doctrine_DBAL_Driver_PDOFirebird_Driver', 'pdo_firebird' => 'Doctrine\DBAL\Driver\PDOFirebird\Driver',
'pdo_informix' => 'Doctrine_DBAL_Driver_PDOInformix_Driver', 'pdo_informix' => 'Doctrine\DBAL\Driver\PDOInformix\Driver',
); );
/** Private constructor. This class cannot be instantiated. */ /** Private constructor. This class cannot be instantiated. */
...@@ -92,20 +94,20 @@ final class Doctrine_DBAL_DriverManager ...@@ -92,20 +94,20 @@ final class Doctrine_DBAL_DriverManager
* @return Doctrine\DBAL\Connection * @return Doctrine\DBAL\Connection
*/ */
public static function getConnection(array $params, public static function getConnection(array $params,
Doctrine_DBAL_Configuration $config = null, Configuration $config = null,
Doctrine_Common_EventManager $eventManager = null) EventManager $eventManager = null)
{ {
// create default config and event manager, if not set // create default config and event manager, if not set
if ( ! $config) { if ( ! $config) {
$config = new Doctrine_DBAL_Configuration(); $config = new Configuration();
} }
if ( ! $eventManager) { if ( ! $eventManager) {
$eventManager = new Doctrine_Common_EventManager(); $eventManager = new EventManager();
} }
// check for existing pdo object // check for existing pdo object
if (isset($params['pdo']) && ! $params['pdo'] instanceof PDO) { if (isset($params['pdo']) && ! $params['pdo'] instanceof PDO) {
throw Doctrine_DBAL_Exceptions_DBALException::invalidPDOInstance(); throw DBALException::invalidPDOInstance();
} else if (isset($params['pdo'])) { } else if (isset($params['pdo'])) {
$params['driver'] = $params['pdo']->getAttribute(PDO::ATTR_DRIVER_NAME); $params['driver'] = $params['pdo']->getAttribute(PDO::ATTR_DRIVER_NAME);
} else { } else {
...@@ -119,7 +121,7 @@ final class Doctrine_DBAL_DriverManager ...@@ -119,7 +121,7 @@ final class Doctrine_DBAL_DriverManager
$driver = new $className(); $driver = new $className();
$wrapperClass = 'Doctrine_DBAL_Connection'; $wrapperClass = 'Doctrine\DBAL\Connection';
if (isset($params['wrapperClass']) && is_subclass_of($params['wrapperClass'], $wrapperClass)) { if (isset($params['wrapperClass']) && is_subclass_of($params['wrapperClass'], $wrapperClass)) {
$wrapperClass = $params['wrapperClass']; $wrapperClass = $params['wrapperClass'];
} }
...@@ -138,16 +140,15 @@ final class Doctrine_DBAL_DriverManager ...@@ -138,16 +140,15 @@ final class Doctrine_DBAL_DriverManager
// driver // driver
if ( ! isset($params['driver']) && ! isset($params['driverClass'])) { if ( ! isset($params['driver']) && ! isset($params['driverClass'])) {
throw Doctrine_ConnectionFactory_Exception::driverRequired(); throw DBALException::driverRequired();
} }
// check validity of parameters // check validity of parameters
// driver // driver
if ( isset($params['driver']) && ! isset(self::$_driverMap[$params['driver']])) { if ( isset($params['driver']) && ! isset(self::$_driverMap[$params['driver']])) {
throw Doctrine_DBAL_Exceptions_DBALException::unknownDriver($params['driver']); throw DBALException::unknownDriver($params['driver']);
} }
} }
} }
?>
\ No newline at end of file
<?php <?php
namespace Doctrine\DBAL\Exceptions;
use Doctrine\Common\DoctrineException;
/** /**
* *
* *
...@@ -11,7 +15,7 @@ ...@@ -11,7 +15,7 @@
* @version $Revision: 1080 $ * @version $Revision: 1080 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/ */
class Doctrine_DBAL_Exceptions_DBALException extends Exception class DBALException extends DoctrineException
{ {
public static function invalidPDOInstance() public static function invalidPDOInstance()
{ {
......
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\DBAL\Platforms; namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Connection;
/** /**
* Base class for all DatabasePlatforms. The DatabasePlatforms are the central * Base class for all DatabasePlatforms. The DatabasePlatforms are the central
...@@ -30,7 +32,7 @@ ...@@ -30,7 +32,7 @@
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) * @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
*/ */
abstract class Doctrine_DBAL_Platforms_AbstractPlatform abstract class AbstractPlatform
{ {
protected $_quoteIdentifiers = false; protected $_quoteIdentifiers = false;
...@@ -1766,7 +1768,7 @@ abstract class Doctrine_DBAL_Platforms_AbstractPlatform ...@@ -1766,7 +1768,7 @@ abstract class Doctrine_DBAL_Platforms_AbstractPlatform
public function getProperty($name) public function getProperty($name)
{ {
if ( ! isset($this->_properties[$name])) { if ( ! isset($this->_properties[$name])) {
throw Doctrine_Connection_Exception::unknownProperty($name); throw DoctrineException::unknownProperty($name);
} }
return $this->_properties[$name]; return $this->_properties[$name];
} }
...@@ -1813,13 +1815,13 @@ abstract class Doctrine_DBAL_Platforms_AbstractPlatform ...@@ -1813,13 +1815,13 @@ abstract class Doctrine_DBAL_Platforms_AbstractPlatform
protected function _getTransactionIsolationLevelSql($level) protected function _getTransactionIsolationLevelSql($level)
{ {
switch ($level) { switch ($level) {
case Doctrine_DBAL_Connection::TRANSACTION_READ_UNCOMMITTED: case Connection::TRANSACTION_READ_UNCOMMITTED:
return 'READ UNCOMMITTED'; return 'READ UNCOMMITTED';
case Doctrine_DBAL_Connection::TRANSACTION_READ_COMMITTED: case Connection::TRANSACTION_READ_COMMITTED:
return 'READ COMMITTED'; return 'READ COMMITTED';
case Doctrine_DBAL_Connection::TRANSACTION_REPEATABLE_READ: case Connection::TRANSACTION_REPEATABLE_READ:
return 'REPEATABLE READ'; return 'REPEATABLE READ';
case Doctrine_DBAL_Connection::TRANSACTION_SERIALIZABLE: case Connection::TRANSACTION_SERIALIZABLE:
return 'SERIALIZABLE'; return 'SERIALIZABLE';
default: default:
throw new Doctrine_Common_Exceptions_DoctrineException('isolation level is not supported: ' . $isolation); throw new Doctrine_Common_Exceptions_DoctrineException('isolation level is not supported: ' . $isolation);
...@@ -1833,7 +1835,7 @@ abstract class Doctrine_DBAL_Platforms_AbstractPlatform ...@@ -1833,7 +1835,7 @@ abstract class Doctrine_DBAL_Platforms_AbstractPlatform
*/ */
public function getSetTransactionIsolationSql($level) public function getSetTransactionIsolationSql($level)
{ {
throw new Doctrine_Export_Exception('Set transaction isolation not supported by this platform.'); throw new DoctrineException('Set transaction isolation not supported by this platform.');
} }
/** /**
...@@ -1844,7 +1846,7 @@ abstract class Doctrine_DBAL_Platforms_AbstractPlatform ...@@ -1844,7 +1846,7 @@ abstract class Doctrine_DBAL_Platforms_AbstractPlatform
*/ */
public function getDefaultTransactionIsolationLevel() public function getDefaultTransactionIsolationLevel()
{ {
return Doctrine_DBAL_Connection::TRANSACTION_READ_COMMITTED; return Connection::TRANSACTION_READ_COMMITTED;
} }
......
<?php <?php
#namespace Doctrine::DBAL::Platforms; namespace Doctrine\DBAL\Platforms;
class Doctrine_DBAL_Platforms_Db2Platform extends Doctrine_DBAL_Platforms_AbstractPlatform class Db2Platform extends AbstractPlatform
{ {
public function getSequenceNextValSql($sequenceName) { public function getSequenceNextValSql($sequenceName) {
...@@ -12,4 +12,3 @@ class Doctrine_DBAL_Platforms_Db2Platform extends Doctrine_DBAL_Platforms_Abstra ...@@ -12,4 +12,3 @@ class Doctrine_DBAL_Platforms_Db2Platform extends Doctrine_DBAL_Platforms_Abstra
} }
?>
\ No newline at end of file
<?php <?php
#namespace Doctrine::DBAL::Platforms; namespace Doctrine\DBAL\Platforms;
/** /**
* Enter description here... * Enter description here...
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Platforms_FirebirdPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform class FirebirdPlatform extends AbstractPlatform
{ {
/** /**
......
<?php <?php
#namespace Doctrine::DBAL::Platforms; namespace Doctrine\DBAL\Platforms;
/** /**
* Enter description here... * Enter description here...
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Platforms_InformixPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform class InformixPlatform extends AbstractPlatform
{ {
public function __construct() public function __construct()
......
<?php <?php
#namespace Doctrine::DBAL::Platforms; namespace Doctrine\DBAL\Platforms;
class Doctrine_DBAL_Platforms_MockPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform class MockPlatform extends AbstractPlatform
{ {
public function getNativeDeclaration(array $field) {} public function getNativeDeclaration(array $field) {}
public function getPortableDeclaration(array $field) {} public function getPortableDeclaration(array $field) {}
} }
?>
\ No newline at end of file
<?php <?php
#namespace Doctrine::DBAL::Platforms; namespace Doctrine\DBAL\Platforms;
class Doctrine_DBAL_Platforms_MsSqlPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform class MsSqlPlatform extends AbstractPlatform
{ {
/** /**
* the constructor * the constructor
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\DBAL\Platforms; namespace Doctrine\DBAL\Platforms;
/** /**
* The MySqlPlatform provides the behavior, features and SQL dialect of the * The MySqlPlatform provides the behavior, features and SQL dialect of the
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* @since 2.0 * @since 2.0
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class Doctrine_DBAL_Platforms_MySqlPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform class MySqlPlatform extends AbstractPlatform
{ {
/** /**
* MySql reserved words. * MySql reserved words.
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine::DBAL::Platforms; namespace Doctrine\DBAL\Platforms;
/** /**
* Base class for all DatabasePlatforms. The DatabasePlatforms are the central * Base class for all DatabasePlatforms. The DatabasePlatforms are the central
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) * @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
*/ */
class Doctrine_DBAL_Platforms_OraclePlatform extends Doctrine_DBAL_Platforms_AbstractPlatform class OraclePlatform extends AbstractPlatform
{ {
/** /**
* Constructor. * Constructor.
......
<?php <?php
#namespace Doctrine::DBAL::Platforms; namespace Doctrine\DBAL\Platforms;
class Doctrine_DBAL_Platforms_PostgreSqlPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform class PostgreSqlPlatform extends AbstractPlatform
{ {
/** /**
* The reserved keywords by pgsql. Ordered alphabetically. * The reserved keywords by pgsql. Ordered alphabetically.
......
<?php <?php
#namespace Doctrine::DBAL::Platforms; namespace Doctrine\DBAL\Platforms;
/** /**
* Enter description here... * Enter description here...
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Platforms_SqlitePlatform extends Doctrine_DBAL_Platforms_AbstractPlatform class SqlitePlatform extends AbstractPlatform
{ {
/** /**
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\DBAL\Schema; namespace Doctrine\DBAL\Schema;
/** /**
* Base class for schema managers. Schema managers are used to inspect and/or * Base class for schema managers. Schema managers are used to inspect and/or
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
* @version $Revision$ * @version $Revision$
* @since 2.0 * @since 2.0
*/ */
abstract class Doctrine_DBAL_Schema_AbstractSchemaManager abstract class AbstractSchemaManager
{ {
protected $_conn; protected $_conn;
public function __construct(Doctrine_DBAL_Connection $conn) public function __construct(\Doctrine\DBAL\Connection $conn)
{ {
$this->_conn = $conn; $this->_conn = $conn;
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine::DBAL::Schema; namespace Doctrine\DBAL\Schema;
/** /**
* xxx * xxx
...@@ -31,13 +31,8 @@ ...@@ -31,13 +31,8 @@
* @version $Revision$ * @version $Revision$
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Schema_FirebirdSchemaManager extends Doctrine_DBAL_Schema_AbstractSchemaManager class FirebirdSchemaManager extends AbstractSchemaManager
{ {
public function __construct(Doctrine_Connection_Firebird $conn)
{
$this->_conn = $conn;
}
/** /**
* list all tables in the current database * list all tables in the current database
* *
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine::DBAL::Schema; namespace Doctrine\DBAL\Schema;
/** /**
* xxx * xxx
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* @version $Revision$ * @version $Revision$
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Schema_InformixSchemaManager extends Doctrine_DBAL_Schema_AbstractSchemaManager class InformixSchemaManager extends AbstractSchemaManager
{ {
protected $sql = array( protected $sql = array(
'listTables' => "SELECT tabname,tabtype FROM systables WHERE tabtype IN ('T','V') AND owner != 'informix'", 'listTables' => "SELECT tabname,tabtype FROM systables WHERE tabtype IN ('T','V') AND owner != 'informix'",
...@@ -54,12 +54,8 @@ class Doctrine_DBAL_Schema_InformixSchemaManager extends Doctrine_DBAL_Schema_Ab ...@@ -54,12 +54,8 @@ class Doctrine_DBAL_Schema_InformixSchemaManager extends Doctrine_DBAL_Schema_Ab
and s2.constrid=r.primary and i2.idxname=s2.idxname", and s2.constrid=r.primary and i2.idxname=s2.idxname",
); );
public function __construct(Doctrine_Connection_Informix $conn)
{
$this->_conn = $conn;
}
} }
?>
\ No newline at end of file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine::DBAL::Schema; namespace Doctrine\DBAL\Schema;
/** /**
* xxx * xxx
...@@ -30,13 +30,8 @@ ...@@ -30,13 +30,8 @@
* @version $Revision$ * @version $Revision$
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Schema_MsSqlSchemaManager extends Doctrine_DBAL_Schema_AbstractSchemaManager class MsSqlSchemaManager extends AbstractSchemaManager
{ {
public function __construct(Doctrine_Connection_Mssql $conn)
{
$this->_conn = $conn;
}
/** /**
* create a new database * create a new database
* *
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\DBAL\Schema; namespace Doctrine\DBAL\Schema;
/** /**
* xxx * xxx
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* @version $Revision$ * @version $Revision$
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Schema_MySqlSchemaManager extends Doctrine_DBAL_Schema_AbstractSchemaManager class MySqlSchemaManager extends AbstractSchemaManager
{ {
/** /**
* lists all database sequences * lists all database sequences
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\DBAL\Schema; namespace Doctrine\DBAL\Schema;
/** /**
* xxx * xxx
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* @version $Revision$ * @version $Revision$
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Schema_OracleSchemaManager extends Doctrine_DBAL_Schema_AbstractSchemaManager class OracleSchemaManager extends AbstractSchemaManager
{ {
/** /**
* create a new database * create a new database
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\DBAL\Schema; namespace Doctrine\DBAL\Schema;
/** /**
* xxx * xxx
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* @version $Revision$ * @version $Revision$
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Schema_PostgreSqlSchemaManager extends Doctrine_DBAL_Schema_AbstractSchemaManager class PostgreSqlSchemaManager extends AbstractSchemaManager
{ {
/** /**
* alter an existing table * alter an existing table
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\DBAL\Schema; namespace Doctrine\DBAL\Schema;
/** /**
* xxx * xxx
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* @version $Revision$ * @version $Revision$
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Schema_SqliteSchemaManager extends Doctrine_DBAL_Schema_AbstractSchemaManager class SqliteSchemaManager extends AbstractSchemaManager
{ {
/** /**
* lists all databases * lists all databases
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
* and is licensed under the LGPL. For more information, see * and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine::DBAL; namespace Doctrine\DBAL;
/** /**
* A thin wrapper around PDOStatement. * A thin wrapper around PDOStatement.
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org * @link www.phpdoctrine.org
* @since 1.0 * @since 1.0
* @version $Revision: 1532 $ * @version $Revision: 1532 $
* @todo Do we seriously need this wrapper? * @todo Do we seriously need this wrapper?
*/ */
class Doctrine_DBAL_Statement class Statement
{ {
/** /**
* @var Doctrine_Connection $conn Doctrine_Connection object, every connection * @var Doctrine_Connection $conn Doctrine_Connection object, every connection
...@@ -51,13 +51,13 @@ class Doctrine_DBAL_Statement ...@@ -51,13 +51,13 @@ class Doctrine_DBAL_Statement
* statement holds an instance of Doctrine_Connection * statement holds an instance of Doctrine_Connection
* @param mixed $stmt * @param mixed $stmt
*/ */
public function __construct(Doctrine_Connection $conn, $stmt) public function __construct(Connection $conn, $stmt)
{ {
$this->_conn = $conn; $this->_conn = $conn;
$this->_stmt = $stmt; $this->_stmt = $stmt;
if ($stmt === false) { if ($stmt === false) {
throw new Doctrine_Exception('Unknown statement object given.'); throw new DoctrineException('Unknown statement object given.');
} }
} }
...@@ -231,7 +231,7 @@ class Doctrine_DBAL_Statement ...@@ -231,7 +231,7 @@ class Doctrine_DBAL_Statement
//$this->_conn->getListener()->postStmtExecute($event); //$this->_conn->getListener()->postStmtExecute($event);
return $result; return $result;
} catch (PDOException $e) { } catch (PDOException $e) {
$this->_conn->rethrowException($e, $this); $this->_conn->rethrowException($e, $this);
} }
......
<?php <?php
namespace Doctrine\DBAL\Types;
/** /**
* Type that maps PHP arrays to VARCHAR SQL type. * Type that maps PHP arrays to VARCHAR SQL type.
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Types_ArrayType extends Doctrine_DBAL_Types_Type class ArrayType extends Type
{ {
......
<?php <?php
/*
* To change this template, choose Tools | Templates namespace Doctrine\DBAL\Types;
* and open the template in the editor.
*/
/** /**
* Type that maps a database BIGINT to a PHP string. * Type that maps a database BIGINT to a PHP string.
* *
* @author robo * @author robo
*/ */
class Doctrine_DBAL_Types_BigIntType extends Doctrine_DBAL_Types_Type class BigIntType extends Type
{ {
//put your code here //put your code here
} }
......
<?php <?php
namespace Doctrine\DBAL\Types;
/** /**
* Type that maps an SQL boolean to a PHP boolean. * Type that maps an SQL boolean to a PHP boolean.
* *
*/ */
class Doctrine_DBAL_Types_BooleanType extends Doctrine_DBAL_Types_Type class BooleanType extends Type
{ {
/** /**
* Enter description here... * Enter description here...
......
<?php <?php
namespace Doctrine\DBAL\Types;
/** /**
* Type that maps a database CHAR to a PHP string. * Type that maps a database CHAR to a PHP string.
* *
* @author robo * @author robo
*/ */
class CharType { class CharType
{
//put your code here //put your code here
} }
<?php <?php
namespace Doctrine\DBAL\Types;
/** /**
* Type that maps an SQL DATETIME to a PHP DateTime object. * Type that maps an SQL DATETIME to a PHP DateTime object.
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Types_DateTimeType extends Doctrine_DBAL_Types_Type class DateTimeType extends Type
{ {
/** /**
* Enter description here... * Enter description here...
......
<?php <?php
namespace Doctrine\DBAL\Types;
/** /**
* Type that maps an SQL DECIMAL to a PHP double. * Type that maps an SQL DECIMAL to a PHP double.
* *
*/ */
class Doctrine_DBAL_Types_DecimalType extends Doctrine_DBAL_Types_Type class DecimalType extends Type
{ {
} }
?>
\ No newline at end of file
<?php <?php
namespace Doctrine\DBAL\Types;
/** /**
* Type that maps an SQL INT to a PHP integer. * Type that maps an SQL INT to a PHP integer.
* *
*/ */
class Doctrine_DBAL_Types_IntegerType extends Doctrine_DBAL_Types_Type class IntegerType extends Type
{ {
public function getName() { return "Integer"; } public function getName() { return "Integer"; }
public function getSqlDeclaration(array $fieldDeclaration, Doctrine_DBAL_Platforms_AbstractPlatform $platform) public function getSqlDeclaration(array $fieldDeclaration, \Doctrine\DBAL\Platforms\AbstractPlatform $platform)
{ {
return $platform->getIntegerTypeDeclarationSql($fieldDeclaration); return $platform->getIntegerTypeDeclarationSql($fieldDeclaration);
} }
......
<?php <?php
/*
* To change this template, choose Tools | Templates namespace Doctrine\DBAL\Types;
* and open the template in the editor.
*/
/** /**
* Description of MediumIntType * Description of MediumIntType
* *
* @author robo * @author robo
*/ */
class MediumIntType { class MediumIntType
{
//put your code here //put your code here
} }
<?php <?php
/*
* To change this template, choose Tools | Templates namespace Doctrine\DBAL\Types;
* and open the template in the editor.
*/
/** /**
* Description of SmallIntType * Description of SmallIntType
* *
* @author robo * @author robo
*/ */
class SmallIntType { class SmallIntType
{
//put your code here //put your code here
} }
?>
<?php <?php
namespace Doctrine\DBAL\Types;
/** /**
* Type that maps an SQL CLOB to a PHP string. * Type that maps an SQL CLOB to a PHP string.
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Types_TextType extends Doctrine_DBAL_Types_Type class TextType extends Type
{ {
/** @override */ /** @override */
public function getSqlDeclaration(array $fieldDeclaration, Doctrine_DatabasePlatform $platform) public function getSqlDeclaration(array $fieldDeclaration, Doctrine_DatabasePlatform $platform)
......
<?php <?php
/*
* To change this template, choose Tools | Templates namespace Doctrine\DBAL\Types;
* and open the template in the editor.
*/
/** /**
* Description of TinyIntType * Description of TinyIntType
* *
* @author robo * @author robo
*/ */
class TinyIntType { class TinyIntType
{
//put your code here //put your code here
} }
<?php <?php
#namespace Doctrine\DBAL\Types; namespace Doctrine\DBAL\Types;
#use Doctrine\DBAL\Platforms\AbstractDatabasePlatform; #use Doctrine\DBAL\Platforms\AbstractDatabasePlatform;
abstract class Doctrine_DBAL_Types_Type abstract class Type
{ {
private static $_typeObjects = array(); private static $_typeObjects = array();
private static $_typesMap = array( private static $_typesMap = array(
'integer' => 'Doctrine_DBAL_Types_IntegerType', 'integer' => 'Doctrine\DBAL\Types\IntegerType',
'int' => 'Doctrine_DBAL_Types_IntegerType', 'int' => '\Doctrine\DBAL\Types\IntegerType',
'tinyint' => 'Doctrine_DBAL_Types_TinyIntType', 'tinyint' => '\Doctrine\DBAL\Types\TinyIntType',
'smallint' => 'Doctrine_DBAL_Types_SmallIntType', 'smallint' => '\Doctrine\DBAL\Types\SmallIntType',
'mediumint' => 'Doctrine_DBAL_Types_MediumIntType', 'mediumint' => '\Doctrine\DBAL\Types\MediumIntType',
'bigint' => 'Doctrine_DBAL_Types_BigIntType', 'bigint' => '\Doctrine\DBAL\Types\BigIntType',
'varchar' => 'Doctrine_DBAL_Types_VarcharType', 'varchar' => 'Doctrine\DBAL\Types\VarcharType',
'text' => 'Doctrine_DBAL_Types_TextType', 'text' => '\Doctrine\DBAL\Types\TextType',
'datetime' => 'Doctrine_DBAL_Types_DateTimeType', 'datetime' => '\Doctrine\DBAL\Types\DateTimeType',
'decimal' => 'Doctrine_DBAL_Types_DecimalType', 'decimal' => '\Doctrine\DBAL\Types\DecimalType',
'double' => 'Doctrine_DBAL_Types_DoubleType' 'double' => '\Doctrine\DBAL\Types\DoubleType'
); );
public function convertToDatabaseValue($value, Doctrine_DBAL_Platforms_AbstractPlatform $platform) public function convertToDatabaseValue($value, \Doctrine\DBAL\Platforms\AbstractPlatform $platform)
{ {
return $value; return $value;
} }
...@@ -31,12 +31,12 @@ abstract class Doctrine_DBAL_Types_Type ...@@ -31,12 +31,12 @@ abstract class Doctrine_DBAL_Types_Type
return $value; return $value;
} }
public function getDefaultLength(Doctrine_DBAL_Platforms_AbstractPlatform $platform) public function getDefaultLength(\Doctrine\DBAL\Platforms\AbstractPlatform $platform)
{ {
return null; return null;
} }
abstract public function getSqlDeclaration(array $fieldDeclaration, Doctrine_DBAL_Platforms_AbstractPlatform $platform); abstract public function getSqlDeclaration(array $fieldDeclaration, \Doctrine\DBAL\Platforms\AbstractPlatform $platform);
abstract public function getName(); abstract public function getName();
/** /**
...@@ -55,7 +55,7 @@ abstract class Doctrine_DBAL_Types_Type ...@@ -55,7 +55,7 @@ abstract class Doctrine_DBAL_Types_Type
} }
if ( ! isset(self::$_typeObjects[$name])) { if ( ! isset(self::$_typeObjects[$name])) {
if ( ! isset(self::$_typesMap[$name])) { if ( ! isset(self::$_typesMap[$name])) {
throw new Doctrine_Exception("Unknown type: $name"); throw new DoctrineException("Unknown type: $name");
} }
self::$_typeObjects[$name] = new self::$_typesMap[$name](); self::$_typeObjects[$name] = new self::$_typesMap[$name]();
} }
...@@ -86,10 +86,9 @@ abstract class Doctrine_DBAL_Types_Type ...@@ -86,10 +86,9 @@ abstract class Doctrine_DBAL_Types_Type
public static function overrideType($name, $className) public static function overrideType($name, $className)
{ {
if ( ! isset(self::$_typesMap[$name])) { if ( ! isset(self::$_typesMap[$name])) {
throw Doctrine_Exception::typeNotFound($name); throw DoctrineException::typeNotFound($name);
} }
self::$_typesMap[$name] = $className; self::$_typesMap[$name] = $className;
} }
} }
?>
\ No newline at end of file
<?php <?php
#namespace Doctrine\DBAL\Types; namespace Doctrine\DBAL\Types;
/** /**
* Type that maps an SQL VARCHAR to a PHP string. * Type that maps an SQL VARCHAR to a PHP string.
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_DBAL_Types_VarcharType extends Doctrine_DBAL_Types_Type class VarcharType extends Type
{ {
/** @override */ /** @override */
public function getSqlDeclaration(array $fieldDeclaration, Doctrine_DBAL_Platforms_AbstractPlatform $platform) public function getSqlDeclaration(array $fieldDeclaration, \Doctrine\DBAL\Platforms\AbstractPlatform $platform)
{ {
return $platform->getVarcharDeclarationSql($fieldDeclaration); return $platform->getVarcharDeclarationSql($fieldDeclaration);
} }
/** @override */ /** @override */
public function getDefaultLength(Doctrine_DBAL_Platforms_AbstractPlatform $platform) public function getDefaultLength(\Doctrine\DBAL\Platforms\AbstractPlatform $platform)
{ {
return $platform->getVarcharDefaultLength(); return $platform->getVarcharDefaultLength();
} }
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
namespace Doctrine\ORM;
/** /**
* Doctrine_ORM_Query_Abstract * Doctrine_ORM_Query_Abstract
* *
...@@ -33,7 +35,7 @@ ...@@ -33,7 +35,7 @@
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo See {@link Doctrine_ORM_Query} * @todo See {@link Doctrine_ORM_Query}
*/ */
abstract class Doctrine_ORM_Query_Abstract abstract class AbstractQuery
{ {
/** /**
* QUERY TYPE CONSTANTS * QUERY TYPE CONSTANTS
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM; namespace Doctrine\ORM;
/** /**
* A persistent collection wrapper. * A persistent collection wrapper.
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @todo Rename to PersistentCollection * @todo Rename to PersistentCollection
*/ */
final class Doctrine_ORM_Collection extends Doctrine_Common_Collections_Collection final class Collection extends \Doctrine\Common\Collections\Collection
{ {
/** /**
* The base type of the collection. * The base type of the collection.
...@@ -109,7 +109,7 @@ final class Doctrine_ORM_Collection extends Doctrine_Common_Collections_Collecti ...@@ -109,7 +109,7 @@ final class Doctrine_ORM_Collection extends Doctrine_Common_Collections_Collecti
/** /**
* Creates a new persistent collection. * Creates a new persistent collection.
*/ */
public function __construct(Doctrine_ORM_EntityManager $em, $entityBaseType, $keyField = null) public function __construct(EntityManager $em, $entityBaseType, $keyField = null)
{ {
$this->_entityBaseType = $entityBaseType; $this->_entityBaseType = $entityBaseType;
$this->_em = $em; $this->_em = $em;
...@@ -151,7 +151,7 @@ final class Doctrine_ORM_Collection extends Doctrine_Common_Collections_Collecti ...@@ -151,7 +151,7 @@ final class Doctrine_ORM_Collection extends Doctrine_Common_Collections_Collecti
* @param object $entity * @param object $entity
* @param AssociationMapping $relation * @param AssociationMapping $relation
*/ */
public function _setOwner($entity, Doctrine_ORM_Mapping_AssociationMapping $relation) public function _setOwner($entity, \Doctrine\ORM\Mapping\AssociationMapping $relation)
{ {
$this->_owner = $entity; $this->_owner = $entity;
$this->_association = $relation; $this->_association = $relation;
......
...@@ -19,10 +19,9 @@ ...@@ -19,10 +19,9 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM; namespace Doctrine\ORM;
#use Doctrine\DBAL\Configuration; use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
#use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
/** /**
* Configuration container for all configuration options of Doctrine. * Configuration container for all configuration options of Doctrine.
...@@ -34,7 +33,7 @@ ...@@ -34,7 +33,7 @@
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @since 2.0 * @since 2.0
*/ */
class Doctrine_ORM_Configuration extends Doctrine_DBAL_Configuration class Configuration extends \Doctrine\DBAL\Configuration
{ {
/** /**
* Creates a new configuration that can be used for Doctrine. * Creates a new configuration that can be used for Doctrine.
...@@ -45,7 +44,7 @@ class Doctrine_ORM_Configuration extends Doctrine_DBAL_Configuration ...@@ -45,7 +44,7 @@ class Doctrine_ORM_Configuration extends Doctrine_DBAL_Configuration
'resultCacheImpl' => null, 'resultCacheImpl' => null,
'queryCacheImpl' => null, 'queryCacheImpl' => null,
'metadataCacheImpl' => null, 'metadataCacheImpl' => null,
'metadataDriverImpl' => new Doctrine_ORM_Mapping_Driver_AnnotationDriver() 'metadataDriverImpl' => new AnnotationDriver()
)); ));
} }
......
...@@ -19,25 +19,25 @@ ...@@ -19,25 +19,25 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM; namespace Doctrine\ORM;
#use Doctrine\Common\Configuration; #use Doctrine\Common\Configuration;
#use Doctrine\Common\EventManager; use Doctrine\Common\EventManager;
#use Doctrine\DBAL\Connection; use Doctrine\Common\DoctrineException;
#use Doctrine\ORM\Exceptions\EntityManagerException; use Doctrine\DBAL\Connection;
#use Doctrine\ORM\Internal\UnitOfWork; use Doctrine\ORM\Exceptions\EntityManagerException;
#use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadata;
/** /**
* The EntityManager is the central access point to ORM functionality. * The EntityManager is the central access point to ORM functionality.
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision$
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class Doctrine_ORM_EntityManager class EntityManager
{ {
/** /**
* IMMEDIATE: Flush occurs automatically after each operation that issues database * IMMEDIATE: Flush occurs automatically after each operation that issues database
...@@ -158,20 +158,20 @@ class Doctrine_ORM_EntityManager ...@@ -158,20 +158,20 @@ class Doctrine_ORM_EntityManager
* @param Doctrine\Common\EventManager $eventManager * @param Doctrine\Common\EventManager $eventManager
*/ */
protected function __construct( protected function __construct(
Doctrine_DBAL_Connection $conn, Connection $conn,
$name, $name,
Doctrine_ORM_Configuration $config, Configuration $config,
Doctrine_Common_EventManager $eventManager) EventManager $eventManager)
{ {
$this->_conn = $conn; $this->_conn = $conn;
$this->_name = $name; $this->_name = $name;
$this->_config = $config; $this->_config = $config;
$this->_eventManager = $eventManager; $this->_eventManager = $eventManager;
$this->_metadataFactory = new Doctrine_ORM_Mapping_ClassMetadataFactory( $this->_metadataFactory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(
$this->_config->getMetadataDriverImpl(), $this->_config->getMetadataDriverImpl(),
$this->_conn->getDatabasePlatform()); $this->_conn->getDatabasePlatform());
$this->_metadataFactory->setCacheDriver($this->_config->getMetadataCacheImpl()); $this->_metadataFactory->setCacheDriver($this->_config->getMetadataCacheImpl());
$this->_unitOfWork = new Doctrine_ORM_UnitOfWork($this); $this->_unitOfWork = new UnitOfWork($this);
} }
/** /**
...@@ -259,14 +259,14 @@ class Doctrine_ORM_EntityManager ...@@ -259,14 +259,14 @@ class Doctrine_ORM_EntityManager
*/ */
protected function _createIdGenerator($generatorType) protected function _createIdGenerator($generatorType)
{ {
if ($generatorType == Doctrine_ORM_Mapping_ClassMetadata::GENERATOR_TYPE_IDENTITY) { if ($generatorType == ClassMetadata::GENERATOR_TYPE_IDENTITY) {
return new Doctrine_ORM_Id_IdentityGenerator($this); return new \Doctrine\ORM\Id\IdentityGenerator($this);
} else if ($generatorType == Doctrine_ORM_Mapping_ClassMetadata::GENERATOR_TYPE_SEQUENCE) { } else if ($generatorType == ClassMetadata::GENERATOR_TYPE_SEQUENCE) {
return new Doctrine_ORM_Id_SequenceGenerator($this); return new \Doctrine\ORM\Id\SequenceGenerator($this);
} else if ($generatorType == Doctrine_ORM_Mapping_ClassMetadata::GENERATOR_TYPE_TABLE) { } else if ($generatorType == ClassMetadata::GENERATOR_TYPE_TABLE) {
return new Doctrine_ORM_Id_TableGenerator($this); return new \Doctrine\ORM\Id\TableGenerator($this);
} else { } else {
return new Doctrine_ORM_Id_Assigned($this); return new \Doctrine\ORM\Id\Assigned($this);
} }
} }
...@@ -278,7 +278,7 @@ class Doctrine_ORM_EntityManager ...@@ -278,7 +278,7 @@ class Doctrine_ORM_EntityManager
*/ */
public function createQuery($dql = "") public function createQuery($dql = "")
{ {
$query = new Doctrine_ORM_Query($this); $query = new Query($this);
if ( ! empty($dql)) { if ( ! empty($dql)) {
$query->setDql($dql); $query->setDql($dql);
} }
...@@ -298,9 +298,9 @@ class Doctrine_ORM_EntityManager ...@@ -298,9 +298,9 @@ class Doctrine_ORM_EntityManager
if ( ! isset($this->_persisters[$entityName])) { if ( ! isset($this->_persisters[$entityName])) {
$class = $this->getClassMetadata($entityName); $class = $this->getClassMetadata($entityName);
if ($class->isInheritanceTypeJoined()) { if ($class->isInheritanceTypeJoined()) {
$persister = new Doctrine_EntityPersister_JoinedSubclass($this, $class); $persister = new \Doctrine\ORM\Persisters\JoinedSubclassPersister($this, $class);
} else { } else {
$persister = new Doctrine_ORM_Persisters_StandardEntityPersister($this, $class); $persister = new \Doctrine\ORM\Persisters\StandardEntityPersister($this, $class);
} }
$this->_persisters[$entityName] = $persister; $this->_persisters[$entityName] = $persister;
} }
...@@ -313,7 +313,7 @@ class Doctrine_ORM_EntityManager ...@@ -313,7 +313,7 @@ class Doctrine_ORM_EntityManager
* @param Doctrine\ORM\Entity $entity * @param Doctrine\ORM\Entity $entity
* @return boolean * @return boolean
*/ */
public function detach(Doctrine_ORM_Entity $entity) public function detach($entity)
{ {
return $this->_unitOfWork->removeFromIdentityMap($entity); return $this->_unitOfWork->removeFromIdentityMap($entity);
} }
...@@ -385,7 +385,7 @@ class Doctrine_ORM_EntityManager ...@@ -385,7 +385,7 @@ class Doctrine_ORM_EntityManager
public function setFlushMode($flushMode) public function setFlushMode($flushMode)
{ {
if ( ! $this->_isFlushMode($flushMode)) { if ( ! $this->_isFlushMode($flushMode)) {
throw Doctrine_ORM_Exceptions_EntityManagerException::invalidFlushMode(); throw EntityManagerException::invalidFlushMode();
} }
$this->_flushMode = $flushMode; $this->_flushMode = $flushMode;
} }
...@@ -472,7 +472,7 @@ class Doctrine_ORM_EntityManager ...@@ -472,7 +472,7 @@ class Doctrine_ORM_EntityManager
public function refresh(Doctrine_ORM_Entity $entity) public function refresh(Doctrine_ORM_Entity $entity)
{ {
$this->_mergeData($entity, $entity->getRepository()->find( $this->_mergeData($entity, $entity->getRepository()->find(
$entity->identifier(), Doctrine_Query::HYDRATE_ARRAY), $entity->identifier(), Query::HYDRATE_ARRAY),
true); true);
} }
...@@ -482,7 +482,7 @@ class Doctrine_ORM_EntityManager ...@@ -482,7 +482,7 @@ class Doctrine_ORM_EntityManager
* @param Doctrine\ORM\Entity $entity The entity to copy. * @param Doctrine\ORM\Entity $entity The entity to copy.
* @return Doctrine\ORM\Entity The new entity. * @return Doctrine\ORM\Entity The new entity.
*/ */
public function copy(Doctrine_ORM_Entity $entity, $deep = false) public function copy($entity, $deep = false)
{ {
//... //...
} }
...@@ -504,7 +504,7 @@ class Doctrine_ORM_EntityManager ...@@ -504,7 +504,7 @@ class Doctrine_ORM_EntityManager
if ($customRepositoryClassName !== null) { if ($customRepositoryClassName !== null) {
$repository = new $customRepositoryClassName($entityName, $metadata); $repository = new $customRepositoryClassName($entityName, $metadata);
} else { } else {
$repository = new Doctrine_ORM_EntityRepository($this, $metadata); $repository = new \Doctrine\ORM\EntityRepository($this, $metadata);
} }
$this->_repositories[$entityName] = $repository; $this->_repositories[$entityName] = $repository;
...@@ -552,7 +552,7 @@ class Doctrine_ORM_EntityManager ...@@ -552,7 +552,7 @@ class Doctrine_ORM_EntityManager
private function _errorIfNotActiveOrClosed() private function _errorIfNotActiveOrClosed()
{ {
if ($this->_closed) { if ($this->_closed) {
throw Doctrine_ORM_Exceptions_EntityManagerException::notActiveOrClosed($this->_name); throw EntityManagerException::notActiveOrClosed($this->_name);
} }
} }
...@@ -587,23 +587,23 @@ class Doctrine_ORM_EntityManager ...@@ -587,23 +587,23 @@ class Doctrine_ORM_EntityManager
{ {
if ( ! isset($this->_hydrators[$hydrationMode])) { if ( ! isset($this->_hydrators[$hydrationMode])) {
switch ($hydrationMode) { switch ($hydrationMode) {
case Doctrine_ORM_Query::HYDRATE_OBJECT: case Query::HYDRATE_OBJECT:
$this->_hydrators[$hydrationMode] = new Doctrine_ORM_Internal_Hydration_ObjectHydrator($this); $this->_hydrators[$hydrationMode] = new \Doctrine\ORM\Internal\Hydration\ObjectHydrator($this);
break; break;
case Doctrine_ORM_Query::HYDRATE_ARRAY: case Doctrine_ORM_Query::HYDRATE_ARRAY:
$this->_hydrators[$hydrationMode] = new Doctrine_ORM_Internal_Hydration_ArrayHydrator($this); $this->_hydrators[$hydrationMode] = new \Doctrine\ORM\Internal\Hydration\ArrayHydrator($this);
break; break;
case Doctrine_ORM_Query::HYDRATE_SCALAR: case Doctrine_ORM_Query::HYDRATE_SCALAR:
$this->_hydrators[$hydrationMode] = new Doctrine_ORM_Internal_Hydration_ScalarHydrator($this); $this->_hydrators[$hydrationMode] = new \Doctrine\ORM\Internal\Hydration\ScalarHydrator($this);
break; break;
case Doctrine_ORM_Query::HYDRATE_SINGLE_SCALAR: case Doctrine_ORM_Query::HYDRATE_SINGLE_SCALAR:
$this->_hydrators[$hydrationMode] = new Doctrine_ORM_Internal_Hydration_SingleScalarHydrator($this); $this->_hydrators[$hydrationMode] = new \Doctrine\ORM\Internal\Hydration\SingleScalarHydrator($this);
break; break;
case Doctrine_ORM_Query::HYDRATE_NONE: case Doctrine_ORM_Query::HYDRATE_NONE:
$this->_hydrators[$hydrationMode] = new Doctrine_ORM_Internal_Hydration_NoneHydrator($this); $this->_hydrators[$hydrationMode] = new \Doctrine\ORM\Internal\Hydration\NoneHydrator($this);
break; break;
default: default:
throw new Doctrine_Exception("No hydrator found for hydration mode '$hydrationMode'."); throw new DoctrineException("No hydrator found for hydration mode '$hydrationMode'.");
} }
} else if ($this->_hydrators[$hydrationMode] instanceof Closure) { } else if ($this->_hydrators[$hydrationMode] instanceof Closure) {
$this->_hydrators[$hydrationMode] = $this->_hydrators[$hydrationMode]($this); $this->_hydrators[$hydrationMode] = $this->_hydrators[$hydrationMode]($this);
...@@ -649,23 +649,23 @@ class Doctrine_ORM_EntityManager ...@@ -649,23 +649,23 @@ class Doctrine_ORM_EntityManager
public static function create( public static function create(
$conn, $conn,
$name, $name,
Doctrine_ORM_Configuration $config = null, Configuration $config = null,
Doctrine_Common_EventManager $eventManager = null) EventManager $eventManager = null)
{ {
if (is_array($conn)) { if (is_array($conn)) {
$conn = Doctrine_DBAL_DriverManager::getConnection($conn, $config, $eventManager); $conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager);
} else if ( ! $conn instanceof Doctrine_DBAL_Connection) { } else if ( ! $conn instanceof Connection) {
throw new Doctrine_Exception("Invalid parameter '$conn'."); throw new DoctrineException("Invalid parameter '$conn'.");
} }
if (is_null($config)) { if (is_null($config)) {
$config = new Doctrine_ORM_Configuration(); $config = new Configuration();
} }
if (is_null($eventManager)) { if (is_null($eventManager)) {
$eventManager = new Doctrine_Common_EventManager(); $eventManager = new EventManager();
} }
$em = new Doctrine_ORM_EntityManager($conn, $name, $config, $eventManager); $em = new EntityManager($conn, $name, $config, $eventManager);
return $em; return $em;
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM; namespace Doctrine\ORM;
/** /**
* A repository provides the illusion of an in-memory Entity store. * A repository provides the illusion of an in-memory Entity store.
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
* @version $Revision$ * @version $Revision$
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class Doctrine_ORM_EntityRepository class EntityRepository
{ {
protected $_entityName; protected $_entityName;
protected $_em; protected $_em;
protected $_classMetadata; protected $_classMetadata;
public function __construct($em, Doctrine_ORM_Mapping_ClassMetadata $classMetadata) public function __construct($em, \Doctrine\ORM\Mapping\ClassMetadata $classMetadata)
{ {
$this->_entityName = $classMetadata->getClassName(); $this->_entityName = $classMetadata->getClassName();
$this->_em = $em; $this->_em = $em;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine::ORM::Exceptions; namespace Doctrine\ORM\Exceptions;
/** /**
* Doctrine_EntityManager_Exception * Doctrine_EntityManager_Exception
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_ORM_Exceptions_EntityManagerException extends Doctrine_ORM_Exceptions_ORMException class EntityManagerException extends \Doctrine\Common\DoctrineException
{ {
public static function invalidFlushMode() public static function invalidFlushMode()
{ {
......
<?php <?php
class Doctrine_ORM_Exceptions_HydrationException extends Doctrine_ORM_Exceptions_ORMException namespace Doctrine\ORM\Exceptions;
class HydrationException extends \Doctrine\Common\DoctrineException
{ {
public static function nonUniqueResult() public static function nonUniqueResult()
...@@ -10,4 +12,3 @@ class Doctrine_ORM_Exceptions_HydrationException extends Doctrine_ORM_Exceptions ...@@ -10,4 +12,3 @@ class Doctrine_ORM_Exceptions_HydrationException extends Doctrine_ORM_Exceptions
} }
?>
\ No newline at end of file
...@@ -19,14 +19,14 @@ ...@@ -19,14 +19,14 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Exceptions; namespace Doctrine\ORM\Exceptions;
/** /**
* A MappingException indicates that something is wrong with the mapping setup. * A MappingException indicates that something is wrong with the mapping setup.
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_ORM_Exceptions_MappingException extends Doctrine_ORM_Exceptions_ORMException class MappingException extends \Doctrine\Common\DoctrineException
{ {
public static function identifierRequired($entityName) public static function identifierRequired($entityName)
{ {
......
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace Doctrine\ORM\Exceptions;
/**
* Description of QueryException
*
* @author robo
*/
class QueryException extends \Doctrine\Common\DoctrineException {
}
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Export; namespace Doctrine\ORM\Export;
/** /**
* The ClassExporter can generate database schemas/structures from ClassMetadata * The ClassExporter can generate database schemas/structures from ClassMetadata
...@@ -35,14 +35,14 @@ ...@@ -35,14 +35,14 @@
* @since 2.0 * @since 2.0
* @version $Revision: 4805 $ * @version $Revision: 4805 $
*/ */
class Doctrine_ORM_Export_ClassExporter class ClassExporter
{ {
/** The SchemaManager */ /** The SchemaManager */
private $_sm; private $_sm;
/** The EntityManager */ /** The EntityManager */
private $_em; private $_em;
public function __construct(Doctrine_ORM_EntityManager $em) public function __construct(\Doctrine\ORM\EntityManager $em)
{ {
$this->_em = $em; $this->_em = $em;
$this->_sm = $em->getConnection()->getSchemaManager(); $this->_sm = $em->getConnection()->getSchemaManager();
......
<?php <?php
#namespace Doctrine\ORM\Id; namespace Doctrine\ORM\Id;
/** /**
* Enter description here... * Enter description here...
*
* @todo Rename to AbstractIdGenerator
*/ */
abstract class Doctrine_ORM_Id_AbstractIdGenerator abstract class AbstractIdGenerator
{ {
protected $_em; protected $_em;
public function __construct(Doctrine_ORM_EntityManager $em) public function __construct(\Doctrine\ORM\EntityManager $em)
{ {
$this->_em = $em; $this->_em = $em;
} }
......
<?php <?php
namespace Doctrine\ORM\Id;
/** /**
* Special generator for application-assigned identifiers (doesnt really generate anything). * Special generator for application-assigned identifiers (doesnt really generate anything).
* *
* @since 2.0 * @since 2.0
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class Doctrine_ORM_Id_Assigned extends Doctrine_ORM_Id_AbstractIdGenerator class Assigned extends AbstractIdGenerator
{ {
/** /**
* Returns the identifier assigned to the given entity. * Returns the identifier assigned to the given entity.
......
<?php <?php
class Doctrine_ORM_Id_IdentityGenerator extends Doctrine_ORM_Id_AbstractIdGenerator namespace Doctrine\ORM\Id;
class IdentityGenerator extends AbstractIdGenerator
{ {
/** /**
* Enter description here... * Enter description here...
......
<?php <?php
class Doctrine_ORM_Id_SequenceGenerator extends Doctrine_ORM_Id_AbstractIdGenerator namespace Doctrine\ORM\Id;
class SequenceGenerator extends AbstractIdGenerator
{ {
private $_sequenceName; private $_sequenceName;
...@@ -23,4 +25,3 @@ class Doctrine_ORM_Id_SequenceGenerator extends Doctrine_ORM_Id_AbstractIdGenera ...@@ -23,4 +25,3 @@ class Doctrine_ORM_Id_SequenceGenerator extends Doctrine_ORM_Id_AbstractIdGenera
} }
} }
?>
\ No newline at end of file
<?php <?php
class Doctrine_ORM_Id_SequenceIdentityGenerator extends Doctrine_ORM_Id_IdentityGenerator namespace Doctrine\ORM\Id;
class SequenceIdentityGenerator extends IdentityGenerator
{ {
private $_sequenceName; private $_sequenceName;
...@@ -22,4 +24,3 @@ class Doctrine_ORM_Id_SequenceIdentityGenerator extends Doctrine_ORM_Id_Identity ...@@ -22,4 +24,3 @@ class Doctrine_ORM_Id_SequenceIdentityGenerator extends Doctrine_ORM_Id_Identity
} }
?>
\ No newline at end of file
<?php <?php
namespace Doctrine\ORM\Id;
/** /**
* Id generator that uses a single-row database table and a hi/lo algorithm. * Id generator that uses a single-row database table and a hi/lo algorithm.
* *
* @since 2.0 * @since 2.0
*/ */
class Doctrine_ORM_Id_TableGenerator extends Doctrine_ORM_Id_AbstractIdGenerator class TableGenerator extends AbstractIdGenerator
{ {
public function generate($entity) public function generate($entity)
{ {
throw new Exception("Not implemented"); throw new \Exception("Not implemented");
} }
} }
?>
\ No newline at end of file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Internal; namespace Doctrine\ORM\Internal;
/** /**
* The CommitOrderCalculator is used by the UnitOfWork to sort out the * The CommitOrderCalculator is used by the UnitOfWork to sort out the
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* @since 2.0 * @since 2.0
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class Doctrine_ORM_Internal_CommitOrderCalculator class CommitOrderCalculator
{ {
private $_currentTime; private $_currentTime;
...@@ -106,7 +106,7 @@ class Doctrine_ORM_Internal_CommitOrderCalculator ...@@ -106,7 +106,7 @@ class Doctrine_ORM_Internal_CommitOrderCalculator
*/ */
public function addNodeWithItem($key, $item) public function addNodeWithItem($key, $item)
{ {
$this->_nodes[$key] = new Doctrine_ORM_Internal_CommitOrderNode($item, $this); $this->_nodes[$key] = new CommitOrderNode($item, $this);
} }
/** /**
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Internal; namespace Doctrine\ORM\Internal;
/** /**
* A CommitOrderNode is a temporary wrapper around ClassMetadata instances * A CommitOrderNode is a temporary wrapper around ClassMetadata instances
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* @since 2.0 * @since 2.0
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class Doctrine_ORM_Internal_CommitOrderNode class CommitOrderNode
{ {
const NOT_VISITED = 1; const NOT_VISITED = 1;
const IN_PROGRESS = 2; const IN_PROGRESS = 2;
...@@ -55,7 +55,7 @@ class Doctrine_ORM_Internal_CommitOrderNode ...@@ -55,7 +55,7 @@ class Doctrine_ORM_Internal_CommitOrderNode
* @param mixed $wrappedObj The object to wrap. * @param mixed $wrappedObj The object to wrap.
* @param Doctrine\ORM\Internal\CommitOrderCalculator $calc The calculator. * @param Doctrine\ORM\Internal\CommitOrderCalculator $calc The calculator.
*/ */
public function __construct($wrappedObj, Doctrine_ORM_Internal_CommitOrderCalculator $calc) public function __construct($wrappedObj, CommitOrderCalculator $calc)
{ {
$this->_wrappedObj = $wrappedObj; $this->_wrappedObj = $wrappedObj;
$this->_calculator = $calc; $this->_calculator = $calc;
...@@ -157,7 +157,7 @@ class Doctrine_ORM_Internal_CommitOrderNode ...@@ -157,7 +157,7 @@ class Doctrine_ORM_Internal_CommitOrderNode
* *
* @param Doctrine\ORM\Internal\CommitOrderNode $node * @param Doctrine\ORM\Internal\CommitOrderNode $node
*/ */
public function before(Doctrine_ORM_Internal_CommitOrderNode $node) public function before(CommitOrderNode $node)
{ {
$this->_relatedNodes[] = $node; $this->_relatedNodes[] = $node;
} }
......
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Internal\Hydration; namespace Doctrine\ORM\Internal\Hydration;
use \PDO;
/** /**
* Base class for all hydrators (ok, we got only 1 currently). * Base class for all hydrators (ok, we got only 1 currently).
...@@ -31,7 +33,7 @@ ...@@ -31,7 +33,7 @@
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator abstract class AbstractHydrator
{ {
/** /**
* @var array $_queryComponents * @var array $_queryComponents
...@@ -69,7 +71,7 @@ abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator ...@@ -69,7 +71,7 @@ abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator
* *
* @param Doctrine\ORM\EntityManager $em The EntityManager to use. * @param Doctrine\ORM\EntityManager $em The EntityManager to use.
*/ */
public function __construct(Doctrine_ORM_EntityManager $em) public function __construct(\Doctrine\ORM\EntityManager $em)
{ {
$this->_em = $em; $this->_em = $em;
$this->_uow = $em->getUnitOfWork(); $this->_uow = $em->getUnitOfWork();
...@@ -86,7 +88,7 @@ abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator ...@@ -86,7 +88,7 @@ abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator
{ {
$this->_stmt = $stmt; $this->_stmt = $stmt;
$this->_prepare($parserResult); $this->_prepare($parserResult);
return new Doctrine_ORM_Internal_Hydration_IterableResult($this); return new IterableResult($this);
} }
/** /**
...@@ -192,10 +194,10 @@ abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator ...@@ -192,10 +194,10 @@ abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator
if ($this->_isIgnoredName($key)) continue; if ($this->_isIgnoredName($key)) continue;
// Cache general information like the column name <-> field name mapping // Cache general information like the column name <-> field name mapping
$e = explode(Doctrine_ORM_Query_ParserRule::SQLALIAS_SEPARATOR, $key); $e = explode(\Doctrine\ORM\Query\ParserRule::SQLALIAS_SEPARATOR, $key);
$columnName = array_pop($e); $columnName = array_pop($e);
$cache[$key]['dqlAlias'] = $this->_tableAliases[ $cache[$key]['dqlAlias'] = $this->_tableAliases[
implode(Doctrine_ORM_Query_ParserRule::SQLALIAS_SEPARATOR, $e) implode(\Doctrine\ORM\Query\ParserRule::SQLALIAS_SEPARATOR, $e)
]; ];
$classMetadata = $this->_queryComponents[$cache[$key]['dqlAlias']]['metadata']; $classMetadata = $this->_queryComponents[$cache[$key]['dqlAlias']]['metadata'];
// check whether it's an aggregate value or a regular field // check whether it's an aggregate value or a regular field
...@@ -261,10 +263,10 @@ abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator ...@@ -261,10 +263,10 @@ abstract class Doctrine_ORM_Internal_Hydration_AbstractHydrator
if ($this->_isIgnoredName($key)) continue; if ($this->_isIgnoredName($key)) continue;
// cache general information like the column name <-> field name mapping // cache general information like the column name <-> field name mapping
$e = explode(Doctrine_ORM_Query_ParserRule::SQLALIAS_SEPARATOR, $key); $e = explode(\Doctrine\ORM\Query\ParserRule::SQLALIAS_SEPARATOR, $key);
$columnName = array_pop($e); $columnName = array_pop($e);
$cache[$key]['dqlAlias'] = $this->_tableAliases[ $cache[$key]['dqlAlias'] = $this->_tableAliases[
implode(Doctrine_ORM_Query_ParserRule::SQLALIAS_SEPARATOR, $e) implode(\Doctrine\ORM\Query\ParserRule::SQLALIAS_SEPARATOR, $e)
]; ];
$classMetadata = $this->_queryComponents[$cache[$key]['dqlAlias']]['metadata']; $classMetadata = $this->_queryComponents[$cache[$key]['dqlAlias']]['metadata'];
// check whether it's an aggregate value or a regular field // check whether it's an aggregate value or a regular field
......
...@@ -4,12 +4,16 @@ ...@@ -4,12 +4,16 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
namespace Doctrine\ORM\Internal\Hydration;
use \PDO;
/** /**
* Description of ArrayHydrator * Description of ArrayHydrator
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Internal_Hydration_ArrayHydrator extends Doctrine_ORM_Internal_Hydration_AbstractHydrator class ArrayHydrator extends AbstractHydrator
{ {
private $_rootAlias; private $_rootAlias;
private $_rootEntityName; private $_rootEntityName;
......
<?php <?php
namespace Doctrine\ORM\Internal\Hydration;
/** /**
* Represents a result structure that can be iterated over, hydrating row-by-row * Represents a result structure that can be iterated over, hydrating row-by-row
* during the iteration. An IterableResult is obtained by AbstractHydrator#iterate(). * during the iteration. An IterableResult is obtained by AbstractHydrator#iterate().
...@@ -6,7 +9,7 @@ ...@@ -6,7 +9,7 @@
* @author robo * @author robo
* @since 2.0 * @since 2.0
*/ */
class Doctrine_ORM_Internal_Hydration_IterableResult class IterableResult
{ {
private $_hydrator; private $_hydrator;
......
<?php <?php
namespace Doctrine\ORM\Internal\Hydration;
use \PDO;
/** /**
* Description of ObjectHydrator * Description of ObjectHydrator
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Internal_Hydration_ObjectHydrator extends Doctrine_ORM_Internal_Hydration_AbstractHydrator class ObjectHydrator extends AbstractHydrator
{ {
/** Collections initialized by the hydrator */ /** Collections initialized by the hydrator */
private $_collections = array(); private $_collections = array();
...@@ -51,7 +54,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectHydrator extends Doctrine_ORM_Intern ...@@ -51,7 +54,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectHydrator extends Doctrine_ORM_Intern
if ($this->_parserResult->isMixedQuery()) { if ($this->_parserResult->isMixedQuery()) {
$result = array(); $result = array();
} else { } else {
$result = new Doctrine_ORM_Collection($this->_em, $this->_rootEntityName); $result = new \Doctrine\ORM\Collection($this->_em, $this->_rootEntityName);
} }
$cache = array(); $cache = array();
...@@ -102,7 +105,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectHydrator extends Doctrine_ORM_Intern ...@@ -102,7 +105,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectHydrator extends Doctrine_ORM_Intern
if ( ! is_object($coll)) { if ( ! is_object($coll)) {
end($coll); end($coll);
$this->_resultPointers[$dqlAlias] =& $coll[key($coll)]; $this->_resultPointers[$dqlAlias] =& $coll[key($coll)];
} else if ($coll instanceof Doctrine_ORM_Collection) { } else if ($coll instanceof \Doctrine\ORM\Collection) {
if (count($coll) > 0) { if (count($coll) > 0) {
$this->_resultPointers[$dqlAlias] = $coll->last(); $this->_resultPointers[$dqlAlias] = $coll->last();
} }
...@@ -113,7 +116,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectHydrator extends Doctrine_ORM_Intern ...@@ -113,7 +116,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectHydrator extends Doctrine_ORM_Intern
private function getCollection($component) private function getCollection($component)
{ {
$coll = new Doctrine_ORM_Collection($this->_em, $component); $coll = new \Doctrine\ORM\Collection($this->_em, $component);
$this->_collections[] = $coll; $this->_collections[] = $coll;
return $coll; return $coll;
} }
...@@ -335,7 +338,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectHydrator extends Doctrine_ORM_Intern ...@@ -335,7 +338,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectHydrator extends Doctrine_ORM_Intern
->getValue($baseElement)); ->getValue($baseElement));
} }
} else if ( ! $this->isFieldSet($baseElement, $relationAlias)) { } else if ( ! $this->isFieldSet($baseElement, $relationAlias)) {
$coll = new Doctrine_ORM_Collection($this->_em, $entityName); $coll = new \Doctrine\ORM\Collection($this->_em, $entityName);
$this->_collections[] = $coll; $this->_collections[] = $coll;
$this->setRelatedElement($baseElement, $relationAlias, $coll); $this->setRelatedElement($baseElement, $relationAlias, $coll);
} }
...@@ -370,7 +373,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectHydrator extends Doctrine_ORM_Intern ...@@ -370,7 +373,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectHydrator extends Doctrine_ORM_Intern
/** {@inheritdoc} */ /** {@inheritdoc} */
protected function _getRowContainer() protected function _getRowContainer()
{ {
return new Doctrine_Common_Collections_Collection; return new \Doctrine\Common\Collections\Collection;
} }
} }
<?php <?php
namespace Doctrine\ORM\Internal\Hydration;
use \PDO;
/** /**
* Hydrator that produces flat, rectangular results of scalar data. * Hydrator that produces flat, rectangular results of scalar data.
* The created result is almost the same as a regular SQL result set, except * The created result is almost the same as a regular SQL result set, except
...@@ -8,7 +12,7 @@ ...@@ -8,7 +12,7 @@
* @author robo * @author robo
* @since 2.0 * @since 2.0
*/ */
class Doctrine_ORM_Internal_Hydration_ScalarHydrator extends Doctrine_ORM_Internal_Hydration_AbstractHydrator class ScalarHydrator extends AbstractHydrator
{ {
/** @override */ /** @override */
protected function _hydrateAll() protected function _hydrateAll()
......
...@@ -4,12 +4,17 @@ ...@@ -4,12 +4,17 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
namespace Doctrine\ORM\Internal\Hydration;
use \PDO;
use Doctrine\ORM\Exceptions\HydrationException;
/** /**
* Description of SingleScalarHydrator * Description of SingleScalarHydrator
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Internal_Hydration_SingleScalarHydrator extends Doctrine_ORM_Internal_Hydration_AbstractHydrator class SingleScalarHydrator extends AbstractHydrator
{ {
/** @override */ /** @override */
protected function _hydrateAll() protected function _hydrateAll()
...@@ -18,7 +23,7 @@ class Doctrine_ORM_Internal_Hydration_SingleScalarHydrator extends Doctrine_ORM_ ...@@ -18,7 +23,7 @@ class Doctrine_ORM_Internal_Hydration_SingleScalarHydrator extends Doctrine_ORM_
$result = $this->_stmt->fetchAll(PDO::FETCH_ASSOC); $result = $this->_stmt->fetchAll(PDO::FETCH_ASSOC);
//TODO: Let this exception be raised by Query as QueryException //TODO: Let this exception be raised by Query as QueryException
if (count($result) > 1 || count($result[0]) > 1) { if (count($result) > 1 || count($result[0]) > 1) {
throw Doctrine_ORM_Exceptions_HydrationException::nonUniqueResult(); throw HydrationException::nonUniqueResult();
} }
$result = $this->_gatherScalarRowData($result[0], $cache); $result = $this->_gatherScalarRowData($result[0], $cache);
return array_shift($result); return array_shift($result);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Mapping; namespace Doctrine\ORM\Mapping;
/** /**
* Base class for association mappings. * Base class for association mappings.
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @since 2.0 * @since 2.0
*/ */
abstract class Doctrine_ORM_Mapping_AssociationMapping abstract class AssociationMapping
{ {
const FETCH_MANUAL = 1; const FETCH_MANUAL = 1;
const FETCH_LAZY = 2; const FETCH_LAZY = 2;
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Mapping; namespace Doctrine\ORM\Mapping;
#use \Serializable; use \ReflectionClass;
/** /**
* A <tt>ClassMetadata</tt> instance holds all the information (metadata) of an entity and * A <tt>ClassMetadata</tt> instance holds all the information (metadata) of an entity and
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @since 2.0 * @since 2.0
*/ */
class Doctrine_ORM_Mapping_ClassMetadata class ClassMetadata
{ {
/* The inheritance mapping types */ /* The inheritance mapping types */
/** /**
...@@ -613,7 +613,7 @@ class Doctrine_ORM_Mapping_ClassMetadata ...@@ -613,7 +613,7 @@ class Doctrine_ORM_Mapping_ClassMetadata
} }
if ( ! is_object($mapping['type'])) { if ( ! is_object($mapping['type'])) {
$mapping['type'] = Doctrine_DBAL_Types_Type::getType($mapping['type']); $mapping['type'] = \Doctrine\DBAL\Types\Type::getType($mapping['type']);
} }
// Complete fieldName and columnName mapping // Complete fieldName and columnName mapping
...@@ -1186,12 +1186,12 @@ class Doctrine_ORM_Mapping_ClassMetadata ...@@ -1186,12 +1186,12 @@ class Doctrine_ORM_Mapping_ClassMetadata
{ {
$this->_validateAndCompleteFieldMapping($mapping); $this->_validateAndCompleteFieldMapping($mapping);
if (isset($this->_fieldMappings[$mapping['fieldName']])) { if (isset($this->_fieldMappings[$mapping['fieldName']])) {
throw Doctrine_ORM_Exceptions_MappingException::duplicateFieldMapping(); throw MappingException::duplicateFieldMapping();
} }
$this->_fieldMappings[$mapping['fieldName']] = $mapping; $this->_fieldMappings[$mapping['fieldName']] = $mapping;
} }
public function addAssociationMapping(Doctrine_ORM_Mapping_AssociationMapping $mapping) public function addAssociationMapping(AssociationMapping $mapping)
{ {
$this->_storeAssociationMapping($mapping); $this->_storeAssociationMapping($mapping);
} }
...@@ -1204,7 +1204,7 @@ class Doctrine_ORM_Mapping_ClassMetadata ...@@ -1204,7 +1204,7 @@ class Doctrine_ORM_Mapping_ClassMetadata
public function mapOneToOne(array $mapping) public function mapOneToOne(array $mapping)
{ {
$mapping = $this->_completeAssociationMapping($mapping); $mapping = $this->_completeAssociationMapping($mapping);
$oneToOneMapping = new Doctrine_ORM_Mapping_OneToOneMapping($mapping); $oneToOneMapping = new OneToOneMapping($mapping);
$this->_storeAssociationMapping($oneToOneMapping); $this->_storeAssociationMapping($oneToOneMapping);
} }
...@@ -1215,7 +1215,7 @@ class Doctrine_ORM_Mapping_ClassMetadata ...@@ -1215,7 +1215,7 @@ class Doctrine_ORM_Mapping_ClassMetadata
* @param AssociationMapping The mapping to register as inverse if it is a mapping * @param AssociationMapping The mapping to register as inverse if it is a mapping
* for the inverse side of an association. * for the inverse side of an association.
*/ */
private function _registerMappingIfInverse(Doctrine_ORM_Mapping_AssociationMapping $assoc) private function _registerMappingIfInverse(AssociationMapping $assoc)
{ {
if ($assoc->isInverseSide()) { if ($assoc->isInverseSide()) {
$this->_inverseMappings[$assoc->getMappedByFieldName()] = $assoc; $this->_inverseMappings[$assoc->getMappedByFieldName()] = $assoc;
...@@ -1230,7 +1230,7 @@ class Doctrine_ORM_Mapping_ClassMetadata ...@@ -1230,7 +1230,7 @@ class Doctrine_ORM_Mapping_ClassMetadata
public function mapOneToMany(array $mapping) public function mapOneToMany(array $mapping)
{ {
$mapping = $this->_completeAssociationMapping($mapping); $mapping = $this->_completeAssociationMapping($mapping);
$oneToManyMapping = new Doctrine_ORM_Mapping_OneToManyMapping($mapping); $oneToManyMapping = new OneToManyMapping($mapping);
$this->_storeAssociationMapping($oneToManyMapping); $this->_storeAssociationMapping($oneToManyMapping);
} }
...@@ -1253,7 +1253,7 @@ class Doctrine_ORM_Mapping_ClassMetadata ...@@ -1253,7 +1253,7 @@ class Doctrine_ORM_Mapping_ClassMetadata
public function mapManyToMany(array $mapping) public function mapManyToMany(array $mapping)
{ {
$mapping = $this->_completeAssociationMapping($mapping); $mapping = $this->_completeAssociationMapping($mapping);
$manyToManyMapping = new Doctrine_ORM_Mapping_ManyToManyMapping($mapping); $manyToManyMapping = new ManyToManyMapping($mapping);
$this->_storeAssociationMapping($manyToManyMapping); $this->_storeAssociationMapping($manyToManyMapping);
} }
...@@ -1262,11 +1262,11 @@ class Doctrine_ORM_Mapping_ClassMetadata ...@@ -1262,11 +1262,11 @@ class Doctrine_ORM_Mapping_ClassMetadata
* *
* @param Doctrine_Association $assocMapping * @param Doctrine_Association $assocMapping
*/ */
private function _storeAssociationMapping(Doctrine_ORM_Mapping_AssociationMapping $assocMapping) private function _storeAssociationMapping(AssociationMapping $assocMapping)
{ {
$sourceFieldName = $assocMapping->getSourceFieldName(); $sourceFieldName = $assocMapping->getSourceFieldName();
if (isset($this->_associationMappings[$sourceFieldName])) { if (isset($this->_associationMappings[$sourceFieldName])) {
throw Doctrine_ORM_Exceptions_MappingException::duplicateFieldMapping(); throw MappingException::duplicateFieldMapping();
} }
$this->_associationMappings[$sourceFieldName] = $assocMapping; $this->_associationMappings[$sourceFieldName] = $assocMapping;
$this->_registerMappingIfInverse($assocMapping); $this->_registerMappingIfInverse($assocMapping);
...@@ -1343,7 +1343,7 @@ class Doctrine_ORM_Mapping_ClassMetadata ...@@ -1343,7 +1343,7 @@ class Doctrine_ORM_Mapping_ClassMetadata
* @param string $event The lifecycle event. * @param string $event The lifecycle event.
* @param Entity $entity The Entity on which the event occured. * @param Entity $entity The Entity on which the event occured.
*/ */
public function invokeLifecycleCallbacks($lifecycleEvent, Doctrine_ORM_Entity $entity) public function invokeLifecycleCallbacks($lifecycleEvent, $entity)
{ {
foreach ($this->getLifecycleCallbacks($lifecycleEvent) as $callback) { foreach ($this->getLifecycleCallbacks($lifecycleEvent) as $callback) {
$entity->$callback(); $entity->$callback();
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Mapping; namespace Doctrine\ORM\Mapping;
#use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
/** /**
* The metadata factory is used to create ClassMetadata objects that contain all the * The metadata factory is used to create ClassMetadata objects that contain all the
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
* @link www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
*/ */
class Doctrine_ORM_Mapping_ClassMetadataFactory class ClassMetadataFactory
{ {
/** The targeted database platform. */ /** The targeted database platform. */
private $_targetPlatform; private $_targetPlatform;
...@@ -47,7 +47,7 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory ...@@ -47,7 +47,7 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory
* *
* @param $driver The metadata driver to use. * @param $driver The metadata driver to use.
*/ */
public function __construct($driver, Doctrine_DBAL_Platforms_AbstractPlatform $targetPlatform) public function __construct($driver, AbstractPlatform $targetPlatform)
{ {
$this->_driver = $driver; $this->_driver = $driver;
$this->_targetPlatform = $targetPlatform; $this->_targetPlatform = $targetPlatform;
...@@ -161,7 +161,7 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory ...@@ -161,7 +161,7 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory
*/ */
protected function _newClassMetadataInstance($className) protected function _newClassMetadataInstance($className)
{ {
return new Doctrine_ORM_Mapping_ClassMetadata($className); return new ClassMetadata($className);
} }
/** /**
...@@ -199,10 +199,10 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory ...@@ -199,10 +199,10 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory
* @param Doctrine_ClassMetadata $class The container for the metadata. * @param Doctrine_ClassMetadata $class The container for the metadata.
* @param string $name The name of the class for which the metadata will be loaded. * @param string $name The name of the class for which the metadata will be loaded.
*/ */
private function _loadClassMetadata(Doctrine_ORM_Mapping_ClassMetadata $class, $name) private function _loadClassMetadata(ClassMetadata $class, $name)
{ {
if ( ! class_exists($name) || empty($name)) { if ( ! class_exists($name) || empty($name)) {
throw new Doctrine_Exception("Couldn't find class " . $name . "."); throw new DoctrineException("Couldn't find class " . $name . ".");
} }
$names = array(); $names = array();
...@@ -224,13 +224,13 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory ...@@ -224,13 +224,13 @@ class Doctrine_ORM_Mapping_ClassMetadataFactory
// Complete Id generator mapping. If AUTO is specified we choose the generator // Complete Id generator mapping. If AUTO is specified we choose the generator
// most appropriate for the target platform. // most appropriate for the target platform.
if ($class->getIdGeneratorType() == Doctrine_ORM_Mapping_ClassMetadata::GENERATOR_TYPE_AUTO) { if ($class->getIdGeneratorType() == \Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_AUTO) {
if ($this->_targetPlatform->prefersSequences()) { if ($this->_targetPlatform->prefersSequences()) {
$class->setIdGeneratorType(Doctrine_ORM_Mapping_ClassMetadata::GENERATOR_TYPE_SEQUENCE); $class->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_SEQUENCE);
} else if ($this->_targetPlatform->prefersIdentityColumns()) { } else if ($this->_targetPlatform->prefersIdentityColumns()) {
$class->setIdGeneratorType(Doctrine_ORM_Mapping_ClassMetadata::GENERATOR_TYPE_IDENTITY); $class->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY);
} else { } else {
$class->setIdGeneratorType(Doctrine_ORM_Mapping_ClassMetadata::GENERATOR_TYPE_TABLE); $class->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_TABLE);
} }
} }
......
<?php <?php
#namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\ORM\Exceptions\MappingException;
/* Addendum annotation reflection extensions */ /* Addendum annotation reflection extensions */
if ( ! class_exists('Addendum', false)) { if ( ! class_exists('\Addendum', false)) {
require_once dirname(__FILE__) . '/addendum/annotations.php'; require dirname(__FILE__) . '/addendum/annotations.php';
} }
require dirname(__FILE__) . '/DoctrineAnnotations.php';
/** /**
* The AnnotationDriver reads the mapping metadata from docblock annotations. * The AnnotationDriver reads the mapping metadata from docblock annotations.
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Mapping_Driver_AnnotationDriver { class AnnotationDriver
{
/** /**
* Loads the metadata for the specified class into the provided container. * Loads the metadata for the specified class into the provided container.
*/ */
public function loadMetadataForClass($className, Doctrine_ORM_Mapping_ClassMetadata $metadata) public function loadMetadataForClass($className, \Doctrine\ORM\Mapping\ClassMetadata $metadata)
{ {
$annotClass = new ReflectionAnnotatedClass($className); $annotClass = new \Addendum\ReflectionAnnotatedClass($className);
if (($entityAnnot = $annotClass->getAnnotation('DoctrineEntity')) === false) { if (($entityAnnot = $annotClass->getAnnotation('DoctrineEntity')) === false) {
throw new Doctrine_ORM_Exceptions_MappingException("$className is no entity."); throw new MappingException("$className is no entity.");
} }
if ($entityAnnot->tableName) { if ($entityAnnot->tableName) {
...@@ -54,7 +58,7 @@ class Doctrine_ORM_Mapping_Driver_AnnotationDriver { ...@@ -54,7 +58,7 @@ class Doctrine_ORM_Mapping_Driver_AnnotationDriver {
$mapping['fieldName'] = $property->getName(); $mapping['fieldName'] = $property->getName();
if ($columnAnnot = $property->getAnnotation('DoctrineColumn')) { if ($columnAnnot = $property->getAnnotation('DoctrineColumn')) {
if ($columnAnnot->type == null) { if ($columnAnnot->type == null) {
throw new Doctrine_ORM_Exceptions_MappingException("Missing type on property " . $property->getName()); throw new MappingException("Missing type on property " . $property->getName());
} }
$mapping['type'] = $columnAnnot->type; $mapping['type'] = $columnAnnot->type;
$mapping['length'] = $columnAnnot->length; $mapping['length'] = $columnAnnot->length;
...@@ -91,59 +95,3 @@ class Doctrine_ORM_Mapping_Driver_AnnotationDriver { ...@@ -91,59 +95,3 @@ class Doctrine_ORM_Mapping_Driver_AnnotationDriver {
} }
} }
} }
/* Annotations */
final class DoctrineEntity extends Annotation {
public $tableName;
public $repositoryClass;
public $inheritanceType;
}
final class DoctrineInheritanceType extends Annotation {}
final class DoctrineDiscriminatorColumn extends Annotation {
public $name;
public $type;
public $length;
}
final class DoctrineDiscriminatorMap extends Annotation {}
final class DoctrineSubClasses extends Annotation {}
final class DoctrineId extends Annotation {}
final class DoctrineIdGenerator extends Annotation {}
final class DoctrineVersion extends Annotation {}
final class DoctrineJoinColumn extends Annotation {
public $name;
public $type;
public $length;
public $onDelete;
public $onUpdate;
}
final class DoctrineColumn extends Annotation {
public $type;
public $length;
public $unique;
public $nullable;
}
final class DoctrineOneToOne extends Annotation {
public $targetEntity;
public $mappedBy;
public $joinColumns;
public $cascade;
}
final class DoctrineOneToMany extends Annotation {
public $mappedBy;
public $targetEntity;
public $cascade;
}
final class DoctrineManyToOne extends Annotation {
public $targetEntity;
public $joinColumns;
public $cascade;
}
final class DoctrineManyToMany extends Annotation {
public $targetEntity;
public $joinColumns;
public $inverseJoinColumns;
public $joinTable;
public $mappedBy;
public $cascade;
}
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/* Annotations */
final class DoctrineEntity extends \Addendum\Annotation {
public $tableName;
public $repositoryClass;
public $inheritanceType;
}
final class DoctrineInheritanceType extends \Addendum\Annotation {}
final class DoctrineDiscriminatorColumn extends \Addendum\Annotation {
public $name;
public $type;
public $length;
}
final class DoctrineDiscriminatorMap extends \Addendum\Annotation {}
final class DoctrineSubClasses extends \Addendum\Annotation {}
final class DoctrineId extends \Addendum\Annotation {}
final class DoctrineIdGenerator extends \Addendum\Annotation {}
final class DoctrineVersion extends \Addendum\Annotation {}
final class DoctrineJoinColumn extends \Addendum\Annotation {
public $name;
public $type;
public $length;
public $onDelete;
public $onUpdate;
}
final class DoctrineColumn extends \Addendum\Annotation {
public $type;
public $length;
public $unique;
public $nullable;
}
final class DoctrineOneToOne extends \Addendum\Annotation {
public $targetEntity;
public $mappedBy;
public $joinColumns;
public $cascade;
}
final class DoctrineOneToMany extends \Addendum\Annotation {
public $mappedBy;
public $targetEntity;
public $cascade;
}
final class DoctrineManyToOne extends \Addendum\Annotation {
public $targetEntity;
public $joinColumns;
public $cascade;
}
final class DoctrineManyToMany extends \Addendum\Annotation {
public $targetEntity;
public $joinColumns;
public $inverseJoinColumns;
public $joinTable;
public $mappedBy;
public $cascade;
}
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**/ **/
namespace Addendum;
use \ReflectionClass;
use \ReflectionMethod;
use \ReflectionProperty;
require_once(dirname(__FILE__).'/annotations/annotation_parser.php'); require_once(dirname(__FILE__).'/annotations/annotation_parser.php');
class Annotation { class Annotation {
...@@ -75,7 +81,7 @@ class AnnotationsBuilder { ...@@ -75,7 +81,7 @@ class AnnotationsBuilder {
$data = $this->parse($targetReflection); $data = $this->parse($targetReflection);
$annotations = array(); $annotations = array();
foreach($data as $class => $parameters) { foreach($data as $class => $parameters) {
if(is_subclass_of($class, 'Annotation')) { if(is_subclass_of($class, '\Addendum\Annotation')) {
foreach($parameters as $params) { foreach($parameters as $params) {
$annotationReflection = new ReflectionClass($class); $annotationReflection = new ReflectionClass($class);
$annotations[$class][] = $annotationReflection->newInstance($params, $targetReflection); $annotations[$class][] = $annotationReflection->newInstance($params, $targetReflection);
...@@ -310,7 +316,7 @@ class Addendum { ...@@ -310,7 +316,7 @@ class Addendum {
/** Raw mode test */ /** Raw mode test */
private static function checkRawDocCommentParsingNeeded() { private static function checkRawDocCommentParsingNeeded() {
if(self::$rawMode === null) { if(self::$rawMode === null) {
$reflection = new ReflectionClass('Addendum'); $reflection = new ReflectionClass('\Addendum\Addendum');
$method = $reflection->getMethod('checkRawDocCommentParsingNeeded'); $method = $reflection->getMethod('checkRawDocCommentParsingNeeded');
self::setRawMode($method->getDocComment() === false); self::setRawMode($method->getDocComment() === false);
} }
......
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**/ **/
namespace Addendum;
class CompositeMatcher { class CompositeMatcher {
protected $matchers = array(); protected $matchers = array();
private $wasConstructed = false; private $wasConstructed = false;
...@@ -332,4 +334,4 @@ ...@@ -332,4 +334,4 @@
return $matches[1]; return $matches[1];
} }
} }
?>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Mapping; namespace Doctrine\ORM\Mapping;
/** /**
* Represents a one-to-many mapping. * Represents a one-to-many mapping.
...@@ -31,9 +31,8 @@ ...@@ -31,9 +31,8 @@
* *
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @since 2.0 * @since 2.0
* @todo Rename to OneToManyMapping
*/ */
class Doctrine_ORM_Mapping_OneToManyMapping extends Doctrine_ORM_Mapping_AssociationMapping class OneToManyMapping extends AssociationMapping
{ {
/** The target foreign key columns that reference the sourceKeyColumns. */ /** The target foreign key columns that reference the sourceKeyColumns. */
/* NOTE: Currently not used because uni-directional one-many not supported atm. */ /* NOTE: Currently not used because uni-directional one-many not supported atm. */
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Mappings; namespace Doctrine\ORM\Mapping;
/** /**
* A one-to-one mapping describes a uni-directional mapping from one entity * A one-to-one mapping describes a uni-directional mapping from one entity
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* @since 2.0 * @since 2.0
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class Doctrine_ORM_Mapping_OneToOneMapping extends Doctrine_ORM_Mapping_AssociationMapping class OneToOneMapping extends AssociationMapping
{ {
/** /**
* Maps the source foreign/primary key columns to the target primary/foreign key columns. * Maps the source foreign/primary key columns to the target primary/foreign key columns.
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Persisters; namespace Doctrine\ORM\Persisters;
/** /**
* Base class for all EntityPersisters. * Base class for all EntityPersisters.
...@@ -27,11 +27,10 @@ ...@@ -27,11 +27,10 @@
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision: 3406 $ * @version $Revision: 3406 $
* @link www.phpdoctrine.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @todo Rename to AbstractEntityPersister
*/ */
abstract class Doctrine_ORM_Persisters_AbstractEntityPersister abstract class AbstractEntityPersister
{ {
/** /**
* The names of all the fields that are available on entities. * The names of all the fields that are available on entities.
...@@ -71,7 +70,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister ...@@ -71,7 +70,7 @@ abstract class Doctrine_ORM_Persisters_AbstractEntityPersister
* that uses the given EntityManager and persists instances of the class described * that uses the given EntityManager and persists instances of the class described
* by the given class metadata descriptor. * by the given class metadata descriptor.
*/ */
public function __construct(Doctrine_ORM_EntityManager $em, Doctrine_ORM_Mapping_ClassMetadata $classMetadata) public function __construct(\Doctrine\ORM\EntityManager $em, \Doctrine\ORM\Mapping\ClassMetadata $classMetadata)
{ {
$this->_em = $em; $this->_em = $em;
$this->_entityName = $classMetadata->getClassName(); $this->_entityName = $classMetadata->getClassName();
......
...@@ -19,9 +19,7 @@ ...@@ -19,9 +19,7 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM\Persisters; namespace Doctrine\ORM\Persisters;
#use Doctrine\ORM\Entity;
/** /**
* The default persister strategy maps a single entity instance to a single database table, * The default persister strategy maps a single entity instance to a single database table,
...@@ -33,12 +31,12 @@ ...@@ -33,12 +31,12 @@
* @link www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
*/ */
class Doctrine_ORM_Persisters_StandardEntityPersister extends Doctrine_ORM_Persisters_AbstractEntityPersister class StandardEntityPersister extends AbstractEntityPersister
{ {
/** /**
* Deletes an entity. * Deletes an entity.
*/ */
protected function _doDelete(Doctrine_ORM_Entity $record) protected function _doDelete($record)
{ {
/*try { /*try {
$this->_conn->beginInternalTransaction(); $this->_conn->beginInternalTransaction();
......
...@@ -20,12 +20,14 @@ ...@@ -20,12 +20,14 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine\ORM; namespace Doctrine\ORM;
use Doctrine\ORM\Query\Parser;
/** /**
* A Doctrine_ORM_Query object represents a DQL query. It is used to query databases for * A Doctrine_ORM_Query object represents a DQL query. It is used to query databases for
* data in an object-oriented fashion. A DQL query understands relations and inheritance * data in an object-oriented fashion. A DQL query understands relations and inheritance
* and is dbms independant. * and is to a large degree dbms independant.
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org * @link www.doctrine-project.org
...@@ -35,7 +37,7 @@ ...@@ -35,7 +37,7 @@
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract class Query extends AbstractQuery
{ {
/* Hydration mode constants */ /* Hydration mode constants */
/** /**
...@@ -122,7 +124,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract ...@@ -122,7 +124,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract
* *
* @param Doctrine\ORM\EntityManager $entityManager * @param Doctrine\ORM\EntityManager $entityManager
*/ */
public function __construct(Doctrine_ORM_EntityManager $entityManager) public function __construct(EntityManager $entityManager)
{ {
$this->_entityManager = $entityManager; $this->_entityManager = $entityManager;
$this->free(); $this->free();
...@@ -165,7 +167,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract ...@@ -165,7 +167,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract
return false; return false;
} }
if ($collection instanceof Doctrine_ORM_Collection) { if ($collection instanceof Collection) {
return $collection->getFirst(); return $collection->getFirst();
} else if (is_array($collection)) { } else if (is_array($collection)) {
return array_shift($collection); return array_shift($collection);
...@@ -208,7 +210,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract ...@@ -208,7 +210,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract
public function parse() public function parse()
{ {
if ($this->_state === self::STATE_DIRTY) { if ($this->_state === self::STATE_DIRTY) {
$parser = new Doctrine_ORM_Query_Parser($this); $parser = new Parser($this);
$this->_parserResult = $parser->parse(); $this->_parserResult = $parser->parse();
$this->_state = self::STATE_CLEAN; $this->_state = self::STATE_CLEAN;
} }
...@@ -243,13 +245,13 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract ...@@ -243,13 +245,13 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract
if ($cached === false) { if ($cached === false) {
// Cache does not exist, we have to create it. // Cache does not exist, we have to create it.
$result = $this->_execute($params, self::HYDRATE_ARRAY); $result = $this->_execute($params, self::HYDRATE_ARRAY);
$queryResult = Doctrine_ORM_Query_CacheHandler::fromResultSet($this, $result); $queryResult = \Doctrine\ORM\Query\CacheHandler::fromResultSet($this, $result);
$cacheDriver->save($hash, $queryResult->toCachedForm(), $this->_resultCacheTTL); $cacheDriver->save($hash, $queryResult->toCachedForm(), $this->_resultCacheTTL);
return $result; return $result;
} else { } else {
// Cache exists, recover it and return the results. // Cache exists, recover it and return the results.
$queryResult = Doctrine_ORM_Query_CacheHandler::fromCachedResult($this, $cached); $queryResult = \Doctrine\ORM\Query\CacheHandler::fromCachedResult($this, $cached);
return $queryResult->getResultSet(); return $queryResult->getResultSet();
} }
...@@ -288,7 +290,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract ...@@ -288,7 +290,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract
$cacheDriver->save($hash, $this->_parserResult->toCachedForm(), $this->_queryCacheTTL); $cacheDriver->save($hash, $this->_parserResult->toCachedForm(), $this->_queryCacheTTL);
} else { } else {
// Cache exists, recover it and return the results. // Cache exists, recover it and return the results.
$this->_parserResult = Doctrine_ORM_Query_CacheHandler::fromCachedQuery($this, $cached); $this->_parserResult = Doctrine\ORM\Query\CacheHandler::fromCachedQuery($this, $cached);
$executor = $this->_parserResult->getSqlExecutor(); $executor = $this->_parserResult->getSqlExecutor();
} }
...@@ -333,8 +335,8 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract ...@@ -333,8 +335,8 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract
*/ */
public function setResultCache($resultCache) public function setResultCache($resultCache)
{ {
if ($resultCache !== null && ! ($resultCache instanceof Doctrine_ORM_Cache_Cache)) { if ($resultCache !== null && ! ($resultCache instanceof \Doctrine\ORM\Cache\Cache)) {
throw new Doctrine_ORM_Query_Exception( throw new DoctrineException(
'Method setResultCache() accepts only an instance of Doctrine_Cache_Interface or null.' 'Method setResultCache() accepts only an instance of Doctrine_Cache_Interface or null.'
); );
} }
...@@ -350,7 +352,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract ...@@ -350,7 +352,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract
*/ */
public function getResultCache() public function getResultCache()
{ {
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->_entityManager->getConnection()->getResultCacheDriver();
...@@ -415,8 +417,8 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract ...@@ -415,8 +417,8 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract
*/ */
public function setQueryCache($queryCache) public function setQueryCache($queryCache)
{ {
if ($queryCache !== null && ! ($queryCache instanceof Doctrine_ORM_Cache_Cache)) { if ($queryCache !== null && ! ($queryCache instanceof \Doctrine\ORM\Cache\Cache)) {
throw new Doctrine_ORM_Query_Exception( throw new DoctrineException(
'Method setResultCache() accepts only an instance of Doctrine_ORM_Cache_Interface or null.' 'Method setResultCache() accepts only an instance of Doctrine_ORM_Cache_Interface or null.'
); );
} }
...@@ -433,7 +435,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract ...@@ -433,7 +435,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract
*/ */
public function getQueryCache() public function getQueryCache()
{ {
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->_entityManager->getConnection()->getQueryCacheDriver();
...@@ -529,7 +531,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract ...@@ -529,7 +531,7 @@ class Doctrine_ORM_Query extends Doctrine_ORM_Query_Abstract
{ {
$result = $this->execute(array(), $hydrationMode); $result = $this->execute(array(), $hydrationMode);
if (count($result) > 1) { if (count($result) > 1) {
throw Doctrine_ORM_Query_Exception::nonUniqueResult(); throw QueryException::nonUniqueResult();
} }
return is_array($result) ? array_shift($result) : $result->getFirst(); return is_array($result) ? array_shift($result) : $result->getFirst();
......
...@@ -4,12 +4,14 @@ ...@@ -4,12 +4,14 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* Description of AggregateExpression * Description of AggregateExpression
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Query_AST_AggregateExpression extends Doctrine_ORM_Query_AST class AggregateExpression extends Node
{ {
private $_functionName; private $_functionName;
private $_pathExpression; private $_pathExpression;
......
...@@ -4,12 +4,14 @@ ...@@ -4,12 +4,14 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* ArithmeticExpression ::= SimpleArithmeticExpression | "(" Subselect ")" * ArithmeticExpression ::= SimpleArithmeticExpression | "(" Subselect ")"
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Query_AST_ArithmeticExpression extends Doctrine_ORM_Query_AST class ArithmeticExpression extends Node
{ {
private $_simpleArithmeticExpression; private $_simpleArithmeticExpression;
private $_subselect; private $_subselect;
......
...@@ -4,12 +4,14 @@ ...@@ -4,12 +4,14 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* ArithmeticFactor ::= [("+" | "-")] ArithmeticPrimary * ArithmeticFactor ::= [("+" | "-")] ArithmeticPrimary
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Query_AST_ArithmeticFactor extends Doctrine_ORM_Query_AST class ArithmeticFactor extends Node
{ {
private $_arithmeticPrimary; private $_arithmeticPrimary;
private $_pSigned; private $_pSigned;
......
...@@ -4,12 +4,14 @@ ...@@ -4,12 +4,14 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* ArithmeticTerm ::= ArithmeticFactor {("*" | "/") ArithmeticFactor}* * ArithmeticTerm ::= ArithmeticFactor {("*" | "/") ArithmeticFactor}*
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Query_AST_ArithmeticTerm extends Doctrine_ORM_Query_AST class ArithmeticTerm extends Node
{ {
private $_factors; private $_factors;
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* ComparisonExpression ::= ArithmeticExpression ComparisonOperator ( QuantifiedExpression | ArithmeticExpression ) | * ComparisonExpression ::= ArithmeticExpression ComparisonOperator ( QuantifiedExpression | ArithmeticExpression ) |
* StringExpression ComparisonOperator (StringExpression | QuantifiedExpression) | * StringExpression ComparisonOperator (StringExpression | QuantifiedExpression) |
...@@ -14,7 +16,7 @@ ...@@ -14,7 +16,7 @@
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Query_AST_ComparisonExpression extends Doctrine_ORM_Query_AST class ComparisonExpression extends Node
{ {
private $_leftExpr; private $_leftExpr;
private $_rightExpr; private $_rightExpr;
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* ComparisonOperator = "=" | "<" | "<=" | "<>" | ">" | ">=" | "!=" * ComparisonOperator = "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="
* *
...@@ -31,7 +33,7 @@ ...@@ -31,7 +33,7 @@
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_ORM_Query_AST_ComparisonOperator extends Doctrine_ORM_Query_AST class ComparisonOperator extends Node
{ {
} }
...@@ -4,12 +4,14 @@ ...@@ -4,12 +4,14 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* ConditionalExpression ::= ConditionalTerm {"OR" ConditionalTerm}* * ConditionalExpression ::= ConditionalTerm {"OR" ConditionalTerm}*
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Query_AST_ConditionalExpression extends Doctrine_ORM_Query_AST class ConditionalExpression extends Node
{ {
private $_conditionalTerms = array(); private $_conditionalTerms = array();
......
...@@ -4,12 +4,14 @@ ...@@ -4,12 +4,14 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* ConditionalFactor ::= ["NOT"] ConditionalPrimary * ConditionalFactor ::= ["NOT"] ConditionalPrimary
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Query_AST_ConditionalFactor extends Doctrine_ORM_Query_AST class ConditionalFactor extends Node
{ {
private $_not = false; private $_not = false;
private $_conditionalPrimary; private $_conditionalPrimary;
......
...@@ -4,12 +4,14 @@ ...@@ -4,12 +4,14 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* ConditionalPrimary ::= SimpleConditionalExpression | "(" ConditionalExpression ")" * ConditionalPrimary ::= SimpleConditionalExpression | "(" ConditionalExpression ")"
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Query_AST_ConditionalPrimary extends Doctrine_ORM_Query_AST class ConditionalPrimary extends Node
{ {
private $_simpleConditionalExpression; private $_simpleConditionalExpression;
private $_conditionalExpression; private $_conditionalExpression;
......
...@@ -4,12 +4,14 @@ ...@@ -4,12 +4,14 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* ConditionalTerm ::= ConditionalFactor {"AND" ConditionalFactor}* * ConditionalTerm ::= ConditionalFactor {"AND" ConditionalFactor}*
* *
* @author robo * @author robo
*/ */
class Doctrine_ORM_Query_AST_ConditionalTerm extends Doctrine_ORM_Query_AST class ConditionalTerm extends Node
{ {
private $_conditionalFactors = array(); private $_conditionalFactors = array();
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* DeleteStatement = DeleteClause [WhereClause] * DeleteStatement = DeleteClause [WhereClause]
* *
...@@ -28,7 +30,7 @@ ...@@ -28,7 +30,7 @@
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_ORM_Query_AST_DeleteStatement extends Doctrine_ORM_Query_AST class DeleteStatement extends Node
{ {
protected $_deleteClause; protected $_deleteClause;
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
namespace Doctrine\ORM\Query\AST;
/** /**
* FromClause ::= "FROM" IdentificationVariableDeclaration {"," IdentificationVariableDeclaration} * FromClause ::= "FROM" IdentificationVariableDeclaration {"," IdentificationVariableDeclaration}
* *
...@@ -28,7 +30,7 @@ ...@@ -28,7 +30,7 @@
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_ORM_Query_AST_FromClause extends Doctrine_ORM_Query_AST class FromClause extends Node
{ {
protected $_identificationVariableDeclarations = array(); protected $_identificationVariableDeclarations = array();
......
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace Doctrine\ORM\Query\AST;
/**
* Description of Function
*
* @author robo
*/
class FunctionNode extends Node
{
private $_name;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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