Commit a7699974 authored by romanb's avatar romanb

--no commit message

--no commit message
parent d17a68a4
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
* @link www.phpdoctrine.org * @link www.phpdoctrine.org
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo Consider making Collection & Entity implement ArrayAccess directly.
* This base class is not really a huge benefit.
*/ */
abstract class Doctrine_Access implements ArrayAccess abstract class Doctrine_Access implements ArrayAccess
{ {
......
...@@ -33,16 +33,16 @@ class Doctrine_Association_ManyToMany extends Doctrine_Association ...@@ -33,16 +33,16 @@ class Doctrine_Association_ManyToMany extends Doctrine_Association
private $_relationTableName; private $_relationTableName;
/** The field in the source table that corresponds to the key in the relation table */ /** The field in the source table that corresponds to the key in the relation table */
protected $_sourceKeyFields; protected $_sourceKeyColumns;
/** The field in the target table that corresponds to the key in the relation table */ /** The field in the target table that corresponds to the key in the relation table */
protected $_targetKeyFields; protected $_targetKeyColumns;
/** The field in the intermediate table that corresponds to the key in the source table */ /** The field in the intermediate table that corresponds to the key in the source table */
protected $_sourceRelationKeyFields; protected $_sourceRelationKeyColumns;
/** The field in the intermediate table that corresponds to the key in the target table */ /** The field in the intermediate table that corresponds to the key in the target table */
protected $_targetRelationKeyFields; protected $_targetRelationKeyColumns;
/** /**
......
...@@ -4,24 +4,24 @@ ...@@ -4,24 +4,24 @@
class Doctrine_Association_OneToMany extends Doctrine_Association class Doctrine_Association_OneToMany extends Doctrine_Association
{ {
/** The target foreign key fields that reference the sourceKeyFields. */ /** The target foreign key columns that reference the sourceKeyColumns. */
protected $_targetForeignKeyFields; protected $_targetForeignKeyColumns;
/** The (typically primary) source key fields that are referenced by the targetForeignKeyFields. */ /** The (typically primary) source key columns that are referenced by the targetForeignKeyColumns. */
protected $_sourceKeyFields; protected $_sourceKeyColumns;
/** This maps the target foreign key fields to the corresponding (primary) source key fields. */ /** This maps the target foreign key columns to the corresponding (primary) source key columns. */
protected $_targetForeignKeysToSourceKeys; protected $_targetForeignKeysToSourceKeys;
/** This maps the (primary) source key fields to the corresponding target foreign key fields. */ /** This maps the (primary) source key columns to the corresponding target foreign key columns. */
protected $_sourceKeysToTargetForeignKeys; protected $_sourceKeysToTargetForeignKeys;
/** Whether to delete orphaned elements (removed from the collection) */ /** Whether to delete orphaned elements (removed from the collection) */
protected $_isCascadeDeleteOrphan = false; protected $_deleteOrphans = false;
public function isCascadeDeleteOrphan() public function shouldDeleteOrphans()
{ {
return $this->_isCascadeDeleteOrphan; return $this->_deleteOrphans;
} }
} }
......
...@@ -34,19 +34,22 @@ ...@@ -34,19 +34,22 @@
class Doctrine_Association_OneToOne extends Doctrine_Association class Doctrine_Association_OneToOne extends Doctrine_Association
{ {
/** /**
* Maps the source foreign/primary key fields to the target primary/foreign key fields. * Maps the source foreign/primary key columns to the target primary/foreign key columns.
* i.e. source.id (pk) => target.user_id (fk). * i.e. source.id (pk) => target.user_id (fk).
* Reverse mapping of _targetToSourceKeyFields. * Reverse mapping of _targetToSourceKeyColumns.
*/ */
protected $_sourceToTargetKeyColumns = array(); protected $_sourceToTargetKeyColumns = array();
/** /**
* Maps the target primary/foreign key fields to the source foreign/primary key fields. * Maps the target primary/foreign key columns to the source foreign/primary key columns.
* i.e. target.user_id (fk) => source.id (pk). * i.e. target.user_id (fk) => source.id (pk).
* Reverse mapping of _sourceToTargetKeyFields. * Reverse mapping of _sourceToTargetKeyColumns.
*/ */
protected $_targetToSourceKeyColumns = array(); protected $_targetToSourceKeyColumns = array();
/** Whether to delete orphaned elements (when nulled out, i.e. $foo->other = null) */
protected $_deleteOrphans = false;
/** /**
* Constructor. * Constructor.
* Creates a new OneToOneMapping. * Creates a new OneToOneMapping.
......
...@@ -40,18 +40,6 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable ...@@ -40,18 +40,6 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
const INHERITANCE_TYPE_SINGLE_TABLE = 'singleTable'; const INHERITANCE_TYPE_SINGLE_TABLE = 'singleTable';
const INHERITANCE_TYPE_TABLE_PER_CLASS = 'tablePerClass'; const INHERITANCE_TYPE_TABLE_PER_CLASS = 'tablePerClass';
/**
* Inheritance types enumeration.
*
* @var array
*/
protected static $_inheritanceTypes = array(
self::INHERITANCE_TYPE_NONE,
self::INHERITANCE_TYPE_JOINED,
self::INHERITANCE_TYPE_SINGLE_TABLE,
self::INHERITANCE_TYPE_TABLE_PER_CLASS
);
/* The Id generator types. TODO: belongs more in a DBAL class */ /* The Id generator types. TODO: belongs more in a DBAL class */
const GENERATOR_TYPE_AUTO = 'auto'; const GENERATOR_TYPE_AUTO = 'auto';
const GENERATOR_TYPE_SEQUENCE = 'sequence'; const GENERATOR_TYPE_SEQUENCE = 'sequence';
...@@ -59,18 +47,14 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable ...@@ -59,18 +47,14 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
const GENERATOR_TYPE_IDENTITY = 'identity'; const GENERATOR_TYPE_IDENTITY = 'identity';
const GENERATOR_TYPE_NONE = 'none'; const GENERATOR_TYPE_NONE = 'none';
/** /* The Entity types */
* Id Generator types enumeration. // A regular entity is assumed to have persistent state that Doctrine should manage.
* const ENTITY_TYPE_REGULAR = 'regular';
* @var array // A transient entity is ignored by Doctrine.
*/ const ENTITY_TYPE_TRANSIENT = 'transient';
protected static $_generatorTypes = array( // A mapped superclass entity is itself not persisted by Doctrine but it's
self::GENERATOR_TYPE_AUTO, // field & association mappings are inherited by subclasses.
self::GENERATOR_TYPE_SEQUENCE, const ENTITY_TYPE_MAPPED_SUPERCLASS = 'mappedSuperclass';
self::GENERATOR_TYPE_TABLE,
self::GENERATOR_TYPE_IDENTITY,
self::GENERATOR_TYPE_NONE
);
/** /**
* The name of the entity class. * The name of the entity class.
...@@ -171,14 +155,11 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable ...@@ -171,14 +155,11 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
* Marks the field as the primary key of the Entity. Multiple fields of an * Marks the field as the primary key of the Entity. Multiple fields of an
* entity can have the id attribute, forming a composite key. * entity can have the id attribute, forming a composite key.
* *
* - <b>generatorType</b> (string, optional, requires: id) * - <b>idGenerator</b> (string, optional)
* The generation type used for the field. Optional. Can only be applied on * Either: idGenerator => 'nameOfGenerator', usually only for TABLE/SEQUENCE generators
* fields that are marked with the 'id' attribute. The possible values are: * Or: idGenerator => 'identity' or 'auto' or 'table' or 'sequence'
* auto, identity, sequence, table. * Note that 'auto', 'table', 'sequence' and 'identity' are reserved names and
* * therefore cant be used as a generator name!
* - <b>generator</b> (array, optional, requires: generationType=table|sequence)
* The generator options for a table or sequence generator. Can only be applied
* on fields that have a generationType of 'table' or 'sequence'.
* *
* - <b>nullable</b> (boolean, optional) * - <b>nullable</b> (boolean, optional)
* Whether the column is nullable. Defaults to TRUE. * Whether the column is nullable. Defaults to TRUE.
...@@ -755,15 +736,16 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable ...@@ -755,15 +736,16 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
if ( ! in_array($mapping['fieldName'], $this->_identifier)) { if ( ! in_array($mapping['fieldName'], $this->_identifier)) {
$this->_identifier[] = $mapping['fieldName']; $this->_identifier[] = $mapping['fieldName'];
} }
if (isset($mapping['generatorType'])) { if (isset($mapping['idGenerator'])) {
if ( ! in_array($mapping['generatorType'], self::$_generatorTypes)) { if ( ! $this->_isIdGeneratorType($mapping['idGenerator'])) {
//TODO: check if the idGenerator specifies an existing generator by name
throw Doctrine_MappingException::invalidGeneratorType($mapping['generatorType']); throw Doctrine_MappingException::invalidGeneratorType($mapping['generatorType']);
} else if (count($this->_identifier) > 1) { } else if (count($this->_identifier) > 1) {
throw Doctrine_MappingException::generatorNotAllowedWithCompositeId(); throw Doctrine_MappingException::generatorNotAllowedWithCompositeId();
} }
$this->_generatorType = $mapping['generatorType']; $this->_generatorType = $mapping['idGenerator'];
} }
// TODO: validate/complete 'generator' mapping // TODO: validate/complete 'tableGenerator' and 'sequenceGenerator' mappings
// Check for composite key // Check for composite key
if ( ! $this->_isIdentifierComposite && count($this->_identifier) > 1) { if ( ! $this->_isIdentifierComposite && count($this->_identifier) > 1) {
...@@ -1170,7 +1152,7 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable ...@@ -1170,7 +1152,7 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
. " must share the same inheritance mapping type and this type must be set" . " must share the same inheritance mapping type and this type must be set"
. " in the root class of the hierarchy."); . " in the root class of the hierarchy.");
} }
if ( ! in_array($type, self::$_inheritanceTypes)) { if ( ! $this->_isInheritanceType($type)) {
throw Doctrine_MappingException::invalidInheritanceType($type); throw Doctrine_MappingException::invalidInheritanceType($type);
} }
...@@ -1410,8 +1392,7 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable ...@@ -1410,8 +1392,7 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
*/ */
public function setTableName($tableName) public function setTableName($tableName)
{ {
$this->setTableOption('tableName', $this->_em->getConnection() $this->setTableOption('tableName', $tableName);
->getFormatter()->getTableName($tableName));
} }
/** /**
...@@ -1440,6 +1421,48 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable ...@@ -1440,6 +1421,48 @@ class Doctrine_ClassMetadata implements Doctrine_Configurable, Serializable
{ {
return true; return true;
} }
/**
* Checks whether the given name identifies an entity type.
*
* @param string $type
* @return boolean
*/
private function _isEntityType($type)
{
return $type == self::ENTITY_TYPE_REGULAR ||
$type == self::ENTITY_TYPE_MAPPED_SUPERCLASS ||
$type == self::ENTITY_TYPE_TRANSIENT;
}
/**
* Checks whether the given name identifies an inheritance type.
*
* @param string $type
* @return boolean
*/
private function _isInheritanceType($type)
{
return $type == self::INHERITANCE_TYPE_NONE ||
$type == self::INHERITANCE_TYPE_SINGLE_TABLE ||
$type == self::INHERITANCE_TYPE_JOINED ||
$type == self::INHERITANCE_TYPE_TABLE_PER_CLASS;
}
/**
* Checks whether the given name identifies an id generator type.
*
* @param string $type
* @return boolean
*/
private function _isIdGeneratorType($type)
{
return $type == self::GENERATOR_TYPE_AUTO ||
$type == self::GENERATOR_TYPE_IDENTITY ||
$type == self::GENERATOR_TYPE_SEQUENCE ||
$type == self::GENERATOR_TYPE_TABLE ||
$type == self::GENERATOR_TYPE_NONE;
}
/** /**
* Adds a one-to-one association mapping. * Adds a one-to-one association mapping.
......
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
* @license http://www.opensource.org/licenses/lgpllicense.php LGPL * @license http://www.opensource.org/licenses/lgpllicense.php LGPL
* @link www.phpdoctrine. * @link www.phpdoctrine.
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
* @todo Remove or put in a separate package and look for a maintainer.
*/ */
class Doctrine_Compiler class Doctrine_Compiler
{ {
......
...@@ -40,7 +40,7 @@ class Doctrine_Configuration ...@@ -40,7 +40,7 @@ class Doctrine_Configuration
* @var array * @var array
*/ */
private $_attributes = array( private $_attributes = array(
'quoteIdentifier' => false, 'quoteIdentifiers' => false,
'indexNameFormat' => '%s_idx', 'indexNameFormat' => '%s_idx',
'sequenceNameFormat' => '%s_seq', 'sequenceNameFormat' => '%s_seq',
'tableNameFormat' => '%s', 'tableNameFormat' => '%s',
...@@ -85,7 +85,7 @@ class Doctrine_Configuration ...@@ -85,7 +85,7 @@ class Doctrine_Configuration
*/ */
public function get($name) public function get($name)
{ {
if ( ! $this->hasAttribute($name)) { if ( ! $this->has($name)) {
throw Doctrine_Configuration_Exception::unknownAttribute($name); throw Doctrine_Configuration_Exception::unknownAttribute($name);
} }
if ($this->_attributes[$name] === $this->_nullObject) { if ($this->_attributes[$name] === $this->_nullObject) {
...@@ -102,7 +102,7 @@ class Doctrine_Configuration ...@@ -102,7 +102,7 @@ class Doctrine_Configuration
*/ */
public function set($name, $value) public function set($name, $value)
{ {
if ( ! $this->hasAttribute($name)) { if ( ! $this->has($name)) {
throw Doctrine_Configuration_Exception::unknownAttribute($name); throw Doctrine_Configuration_Exception::unknownAttribute($name);
} }
// TODO: do some value checking depending on the attribute // TODO: do some value checking depending on the attribute
......
This diff is collapsed.
...@@ -69,7 +69,6 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection ...@@ -69,7 +69,6 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
} }
/** /**
* quoteIdentifier
* Quote a string so it can be safely used as a table / column name * Quote a string so it can be safely used as a table / column name
* *
* Quoting style depends on which database driver is being used. * Quoting style depends on which database driver is being used.
......
...@@ -90,7 +90,6 @@ class Doctrine_Connection_UnitOfWork ...@@ -90,7 +90,6 @@ class Doctrine_Connection_UnitOfWork
* entities need to be written to the database. * entities need to be written to the database.
* *
* @var Doctrine::ORM::Internal::CommitOrderCalculator * @var Doctrine::ORM::Internal::CommitOrderCalculator
* @todo Implementation. Replace buildFlushTree().
*/ */
protected $_commitOrderCalculator; protected $_commitOrderCalculator;
...@@ -563,6 +562,13 @@ class Doctrine_Connection_UnitOfWork ...@@ -563,6 +562,13 @@ class Doctrine_Connection_UnitOfWork
// In both cases we must commit the inserts instantly. // In both cases we must commit the inserts instantly.
//TODO: Isnt it enough to only execute the inserts instead of full flush? //TODO: Isnt it enough to only execute the inserts instead of full flush?
$this->commit(); $this->commit();
/* The following may be better:
$commitOrder = $this->_getCommitOrder($insertNow);
foreach ($commitOrder as $class) {
$this->_executeInserts($class);
}
//... remove them from _newEntities, or dont store them there in the first place
*/
} }
} }
...@@ -593,11 +599,12 @@ class Doctrine_Connection_UnitOfWork ...@@ -593,11 +599,12 @@ class Doctrine_Connection_UnitOfWork
$this->_newEntities[$entity->getOid()] = $entity; $this->_newEntities[$entity->getOid()] = $entity;
} else if ( ! $class->usesIdGenerator()) { } else if ( ! $class->usesIdGenerator()) {
$insertNow[$entity->getOid()] = $entity; $insertNow[$entity->getOid()] = $entity;
$this->_newEntities[$entity->getOid()] = $entity;
//... //...
} else if ($class->isIdGeneratorSequence()) { } else if ($class->isIdGeneratorSequence()) {
// Get the next sequence number // Get the next sequence number
//TODO: sequence name? //TODO: sequence name?
$id = $this->_em->getConnection()->getSequenceModule()->nextId("foo"); $id = $this->_em->getConnection()->getSequenceManager()->nextId("foo");
$entity->set($class->getSingleIdentifierFieldName(), $id); $entity->set($class->getSingleIdentifierFieldName(), $id);
$this->registerNew($entity); $this->registerNew($entity);
} else { } else {
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
* @version $Revision$ * @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) * @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @todo Merge all the DataDict classes into the appropriate DBAL DatabasePlatform classes.
*/ */
class Doctrine_DataDict extends Doctrine_Connection_Module class Doctrine_DataDict extends Doctrine_Connection_Module
{ {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* 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>.
*/ */
Doctrine::autoload('Doctrine_DataDict');
/** /**
* @package Doctrine * @package Doctrine
* @subpackage DataDict * @subpackage DataDict
...@@ -108,7 +108,7 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict ...@@ -108,7 +108,7 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
*/ */
public function getPortableDeclaration($field) public function getPortableDeclaration($field)
{ {
$length = (isset($field['length']) && $field['length'] > 0) ? $field['length'] : null; $length = (isset($field['length']) && $field['length'] > 0) ? $field['length'] : null;
$type = array(); $type = array();
$unsigned = $fixed = null; $unsigned = $fixed = null;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* 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>.
*/ */
Doctrine::autoload('Doctrine_DataDict');
/** /**
* @package Doctrine * @package Doctrine
* @subpackage DataDict * @subpackage DataDict
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* 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>.
*/ */
Doctrine::autoload('Doctrine_DataDict');
/** /**
* @package Doctrine * @package Doctrine
* @subpackage DataDict * @subpackage DataDict
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* 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>.
*/ */
Doctrine::autoload('Doctrine_DataDict');
/** /**
* @package Doctrine * @package Doctrine
* @subpackage DataDict * @subpackage DataDict
......
This diff is collapsed.
...@@ -403,6 +403,27 @@ class Doctrine_EntityManager ...@@ -403,6 +403,27 @@ class Doctrine_EntityManager
$this->_unitOfWork->delete($entity); $this->_unitOfWork->delete($entity);
} }
/**
* Refreshes the persistent state of the entity from the database.
*
* @param Doctrine_Entity $entity
*/
public function refresh(Doctrine_Entity $entity)
{
//...
}
/**
* Creates a copy of the given entity. Can create a shallow or a deep copy.
*
* @param Doctrine::ORM::Entity $entity The entity to copy.
* @return Doctrine::ORM::Entity The new entity.
*/
public function copy(Doctrine_Entity $entity, $deep = false)
{
//...
}
/** /**
* Gets the repository for an Entity. * Gets the repository for an Entity.
* *
...@@ -466,12 +487,6 @@ class Doctrine_EntityManager ...@@ -466,12 +487,6 @@ class Doctrine_EntityManager
} else { } else {
$entity = new $className; $entity = new $className;
} }
/*if (count($data) < $classMetadata->getMappedColumnCount()) {
$entity->_state(Doctrine_Entity::STATE_PROXY);
} else {
$entity->_state(Doctrine_Entity::STATE_CLEAN);
}*/
return $entity; return $entity;
} }
...@@ -523,20 +538,10 @@ class Doctrine_EntityManager ...@@ -523,20 +538,10 @@ class Doctrine_EntityManager
} }
} }
/**
* Gets the UnitOfWork used by the EntityManager.
*
* @return UnitOfWork
*/
/*public function getUnitOfWork()
{
return $this->_unitOfWork;
}*/
/** /**
* Gets the EventManager used by the EntityManager. * Gets the EventManager used by the EntityManager.
* *
* @return EventManager * @return Doctrine::Common::EventManager
*/ */
public function getEventManager() public function getEventManager()
{ {
...@@ -546,7 +551,7 @@ class Doctrine_EntityManager ...@@ -546,7 +551,7 @@ class Doctrine_EntityManager
/** /**
* Sets the EventManager used by the EntityManager. * Sets the EventManager used by the EntityManager.
* *
* @param Doctrine_EventManager $eventManager * @param Doctrine::Common::EventManager $eventManager
*/ */
public function setEventManager(Doctrine_EventManager $eventManager) public function setEventManager(Doctrine_EventManager $eventManager)
{ {
...@@ -556,7 +561,7 @@ class Doctrine_EntityManager ...@@ -556,7 +561,7 @@ class Doctrine_EntityManager
/** /**
* Sets the Configuration used by the EntityManager. * Sets the Configuration used by the EntityManager.
* *
* @param Doctrine_Configuration $config * @param Doctrine::Common::Configuration $config
*/ */
public function setConfiguration(Doctrine_Configuration $config) public function setConfiguration(Doctrine_Configuration $config)
{ {
...@@ -566,7 +571,7 @@ class Doctrine_EntityManager ...@@ -566,7 +571,7 @@ class Doctrine_EntityManager
/** /**
* Gets the Configuration used by the EntityManager. * Gets the Configuration used by the EntityManager.
* *
* @return Configuration * @return Doctrine::Common::Configuration
*/ */
public function getConfiguration() public function getConfiguration()
{ {
......
...@@ -19,20 +19,22 @@ ...@@ -19,20 +19,22 @@
* <http://www.phpdoctrine.org>. * <http://www.phpdoctrine.org>.
*/ */
#namespace Doctrine::ORM::Persisters;
/** /**
* * Base class for all EntityPersisters.
* *
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @package Doctrine
* @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.phpdoctrine.org
* @since 2.0 * @since 2.0
* @todo Rename to AbstractEntityPersister
*/ */
abstract class Doctrine_EntityPersister_Abstract abstract class Doctrine_EntityPersister_Abstract
{ {
/** /**
* The names of all the fields that are available on entities created by this mapper. * The names of all the fields that are available on entities.
*/ */
protected $_fieldNames = array(); protected $_fieldNames = array();
...@@ -44,9 +46,11 @@ abstract class Doctrine_EntityPersister_Abstract ...@@ -44,9 +46,11 @@ abstract class Doctrine_EntityPersister_Abstract
protected $_classMetadata; protected $_classMetadata;
/** /**
* The name of the domain class this mapper is used for. * The name of the Entity the persister is used for.
*
* @var string
*/ */
protected $_domainClassName; protected $_entityName;
/** /**
* The Doctrine_Connection object that the database connection of this mapper. * The Doctrine_Connection object that the database connection of this mapper.
...@@ -58,7 +62,7 @@ abstract class Doctrine_EntityPersister_Abstract ...@@ -58,7 +62,7 @@ abstract class Doctrine_EntityPersister_Abstract
/** /**
* The EntityManager. * The EntityManager.
* *
* @var unknown_type * @var Doctrine::ORM::EntityManager
*/ */
protected $_em; protected $_em;
...@@ -66,32 +70,102 @@ abstract class Doctrine_EntityPersister_Abstract ...@@ -66,32 +70,102 @@ abstract class Doctrine_EntityPersister_Abstract
* Null object. * Null object.
*/ */
private $_nullObject; private $_nullObject;
/**
* Enter description here...
*
* @var unknown_type
* @todo To EntityManager.
*/
private $_dataTemplate = array();
/** /**
* Constructs a new mapper. * Constructs a new persister.
*
* @param string $name The name of the domain class this mapper is used for.
* @param Doctrine_Table $table The table object used for the mapping procedure.
* @throws Doctrine_Connection_Exception if there are no opened connections
*/ */
public function __construct(Doctrine_EntityManager $em, Doctrine_ClassMetadata $classMetadata) public function __construct(Doctrine_EntityManager $em, Doctrine_ClassMetadata $classMetadata)
{ {
$this->_em = $em; $this->_em = $em;
$this->_domainClassName = $classMetadata->getClassName(); $this->_entityName = $classMetadata->getClassName();
$this->_conn = $classMetadata->getConnection(); $this->_conn = $em->getConnection();
$this->_classMetadata = $classMetadata; $this->_classMetadata = $classMetadata;
$this->_nullObject = Doctrine_Null::$INSTANCE; $this->_nullObject = Doctrine_Null::$INSTANCE;
} }
public function insert(Doctrine_Entity $entity)
{
//...
}
public function update(Doctrine_Entity $entity)
{
//...
}
public function delete(Doctrine_Entity $entity)
{
}
/**
* Inserts a row into a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _insertRow($tableName, array $data)
{
$this->_conn->insert($tableName, $data);
}
/**
* Deletes rows of a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _deleteRow($tableName, array $identifierToMatch)
{
$this->_conn->delete($tableName, $identifierToMatch);
}
/**
* Deletes rows of a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _updateRow($tableName, array $data, array $identifierToMatch)
{
$this->_conn->update($tableName, $data, $identifierToMatch);
}
public function getClassMetadata()
{
return $this->_classMetadata;
}
public function getFieldNames()
{
if ($this->_fieldNames) {
return $this->_fieldNames;
}
$this->_fieldNames = $this->_classMetadata->getFieldNames();
return $this->_fieldNames;
}
public function getOwningClass($fieldName)
{
return $this->_classMetadata;
}
/**
* Callback that is invoked during the SQL construction process.
*/
public function getCustomJoins()
{
return array();
}
/**
* Callback that is invoked during the SQL construction process.
*/
public function getCustomFields()
{
return array();
}
/** /**
* Assumes that the keys of the given field array are field names and converts * Assumes that the keys of the given field array are field names and converts
* them to column names. * them to column names.
...@@ -108,6 +182,14 @@ abstract class Doctrine_EntityPersister_Abstract ...@@ -108,6 +182,14 @@ abstract class Doctrine_EntityPersister_Abstract
return $converted; return $converted;
} }
#############################################################
# The following is old code that needs to be removed/ported
/** /**
* deletes all related composites * deletes all related composites
* this method is always called internally when a record is deleted * this method is always called internally when a record is deleted
...@@ -129,19 +211,6 @@ abstract class Doctrine_EntityPersister_Abstract ...@@ -129,19 +211,6 @@ abstract class Doctrine_EntityPersister_Abstract
} }
} }
/**
* sets the connection for this class
*
* @params Doctrine_Connection a connection object
* @return Doctrine_Table this object
* @todo refactor
*/
/*public function setConnection(Doctrine_Connection $conn)
{
$this->_conn = $conn;
return $this;
}*/
/** /**
* Returns the connection the mapper is currently using. * Returns the connection the mapper is currently using.
* *
...@@ -482,7 +551,7 @@ abstract class Doctrine_EntityPersister_Abstract ...@@ -482,7 +551,7 @@ abstract class Doctrine_EntityPersister_Abstract
* @return boolean true on success, false on failure * @return boolean true on success, false on failure
* @throws Doctrine_Mapper_Exception * @throws Doctrine_Mapper_Exception
*/ */
public function delete(Doctrine_Entity $record, Doctrine_Connection $conn = null) public function delete_old(Doctrine_Entity $record)
{ {
if ( ! $record->exists()) { if ( ! $record->exists()) {
return false; return false;
...@@ -513,80 +582,5 @@ abstract class Doctrine_EntityPersister_Abstract ...@@ -513,80 +582,5 @@ abstract class Doctrine_EntityPersister_Abstract
return true; return true;
} }
abstract protected function _doDelete(Doctrine_Entity $entity);
/**
* Inserts a row into a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _insertRow($tableName, array $data)
{
$this->_conn->insert($tableName, $data);
}
/**
* Deletes rows of a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _deleteRow($tableName, array $identifierToMatch)
{
$this->_conn->delete($tableName, $identifierToMatch);
}
/**
* Deletes rows of a table.
*
* @todo This method could be used to allow mapping to secondary table(s).
* @see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable
*/
protected function _updateRow($tableName, array $data, array $identifierToMatch)
{
$this->_conn->update($tableName, $data, $identifierToMatch);
}
public function getClassMetadata()
{
return $this->_classMetadata;
}
/*public function getFieldName($columnName)
{
return $this->_classMetadata->getFieldName($columnName);
}*/
public function getFieldNames()
{
if ($this->_fieldNames) {
return $this->_fieldNames;
}
$this->_fieldNames = $this->_classMetadata->getFieldNames();
return $this->_fieldNames;
}
public function getOwningClass($fieldName)
{
return $this->_classMetadata;
}
/* Hooks used during SQL query construction to manipulate the query. */
/**
* Callback that is invoked during the SQL construction process.
*/
public function getCustomJoins()
{
return array();
}
/**
* Callback that is invoked during the SQL construction process.
*/
public function getCustomFields()
{
return array();
}
} }
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
* @link www.phpdoctrine.org * @link www.phpdoctrine.org
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
* @todo Rename to ExportManager. Subclasses: MySqlExportManager, PgSqlExportManager etc.
*/ */
class Doctrine_Export extends Doctrine_Connection_Module class Doctrine_Export extends Doctrine_Connection_Module
{ {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* 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>.
*/ */
Doctrine::autoload('Doctrine_Export');
/** /**
* Doctrine_Export_Oracle * Doctrine_Export_Oracle
* *
......
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
* @link www.phpdoctrine.org * @link www.phpdoctrine.org
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo Merge all Expression classes into the appropriate DBAL DatabasePlatform classes.
*/ */
class Doctrine_Expression class Doctrine_Expression
{ {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* 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>.
*/ */
Doctrine::autoload('Doctrine_Connection_Module');
/** /**
* Doctrine_Expression_Driver * Doctrine_Expression_Driver
* *
......
...@@ -30,219 +30,10 @@ ...@@ -30,219 +30,10 @@
* @link www.phpdoctrine.org * @link www.phpdoctrine.org
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo Remove
*/ */
class Doctrine_Formatter extends Doctrine_Connection_Module class Doctrine_Formatter extends Doctrine_Connection_Module
{ {
/**
* Quotes pattern (% and _) characters in a string)
*
* EXPERIMENTAL
*
* WARNING: this function is experimental and may change signature at
* any time until labelled as non-experimental
*
* @param string the input string to quote
*
* @return string quoted string
*/
public function escapePattern($text)
{
return $text;
/*if ( ! $this->string_quoting['escape_pattern']) {
return $text;
}
$tmp = $this->conn->string_quoting;
$text = str_replace($tmp['escape_pattern'],
$tmp['escape_pattern'] .
$tmp['escape_pattern'], $text);
foreach ($this->wildcards as $wildcard) {
$text = str_replace($wildcard, $tmp['escape_pattern'] . $wildcard, $text);
}
return $text;*/
}
/**
* convertBooleans
* some drivers need the boolean values to be converted into integers
* when using DQL API
*
* This method takes care of that conversion
*
* @param array $item
* @return void
*/
public function convertBooleans($item)
{
if (is_array($item)) {
foreach ($item as $k => $value) {
if (is_bool($value)) {
$item[$k] = (int) $value;
}
}
} else {
if (is_bool($item)) {
$item = (int) $item;
}
}
return $item;
}
/**
* Quote a string so it can be safely used as a table or column name
*
* Delimiting style depends on which database driver is being used.
*
* NOTE: just because you CAN use delimited identifiers doesn't mean
* you SHOULD use them. In general, they end up causing way more
* problems than they solve.
*
* Portability is broken by using the following characters inside
* delimited identifiers:
* + backtick (<kbd>`</kbd>) -- due to MySQL
* + double quote (<kbd>"</kbd>) -- due to Oracle
* + brackets (<kbd>[</kbd> or <kbd>]</kbd>) -- due to Access
*
* Delimited identifiers are known to generally work correctly under
* the following drivers:
* + mssql
* + mysql
* + mysqli
* + oci8
* + pgsql
* + sqlite
*
* InterBase doesn't seem to be able to use delimited identifiers
* via PHP 4. They work fine under PHP 5.
*
* @param string $str identifier name to be quoted
* @param bool $checkOption check the 'quote_identifier' option
*
* @return string quoted identifier string
*/
public function quoteIdentifier($str, $checkOption = true)
{
if ($checkOption && ! $this->conn->getAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER)) {
return $str;
}
$tmp = $this->conn->identifier_quoting;
$str = str_replace($tmp['end'],
$tmp['escape'] .
$tmp['end'], $str);
return $tmp['start'] . $str . $tmp['end'];
}
/**
* quote
* quotes given input parameter
*
* @param mixed $input parameter to be quoted
* @param string $type
* @return mixed
*/
public function quote($input, $type = null)
{
if ($type == null) {
$type = gettype($input);
}
switch ($type) {
case 'integer':
case 'enum':
case 'boolean':
case 'double':
case 'float':
case 'bool':
case 'decimal':
case 'int':
return $input;
case 'array':
case 'object':
$input = serialize($input);
case 'date':
case 'time':
case 'timestamp':
case 'string':
case 'char':
case 'varchar':
case 'text':
case 'gzip':
case 'blob':
case 'clob':
return $this->conn->quote($input);
}
}
/**
* Removes any formatting in an sequence name using the 'seqname_format' option
*
* @param string $sqn string that containts name of a potential sequence
* @return string name of the sequence with possible formatting removed
*/
public function fixSequenceName($sqn)
{
$seqPattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $this->conn->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT)).'$/i';
$seqName = preg_replace($seqPattern, '\\1', $sqn);
if ($seqName && ! strcasecmp($sqn, $this->getSequenceName($seqName))) {
return $seqName;
}
return $sqn;
}
/**
* Removes any formatting in an index name using the 'idxname_format' option
*
* @param string $idx string that containts name of anl index
* @return string name of the index with possible formatting removed
*/
public function fixIndexName($idx)
{
$indexPattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $this->conn->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT)).'$/i';
$indexName = preg_replace($indexPattern, '\\1', $idx);
if ($indexName && ! strcasecmp($idx, $this->getIndexName($indexName))) {
return $indexName;
}
return $idx;
}
/**
* adds sequence name formatting to a sequence name
*
* @param string name of the sequence
* @return string formatted sequence name
*/
public function getSequenceName($sqn)
{
return sprintf($this->conn->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT),
preg_replace('/[^a-z0-9_\$.]/i', '_', $sqn));
}
/**
* adds index name formatting to a index name
*
* @param string name of the index
* @return string formatted index name
*/
public function getIndexName($idx)
{
return sprintf($this->conn->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT),
preg_replace('/[^a-z0-9_\$]/i', '_', $idx));
}
/**
* adds table name formatting to a table name
*
* @param string name of the table
* @return string formatted table name
*/
public function getTableName($table)
{
return $table;
/*
return sprintf($this->conn->getAttribute(Doctrine::ATTR_TBLNAME_FORMAT),
$table);*/
}
} }
...@@ -20,15 +20,14 @@ ...@@ -20,15 +20,14 @@
*/ */
/** /**
* Doctrine_Hydrator_Abstract * Base class for all hydrators (ok, we got only 1 currently).
* *
* @package Doctrine
* @subpackage Hydrate
* @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: 3192 $ * @version $Revision: 3192 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/ */
abstract class Doctrine_Hydrator_Abstract abstract class Doctrine_Hydrator_Abstract
{ {
...@@ -71,7 +70,6 @@ abstract class Doctrine_Hydrator_Abstract ...@@ -71,7 +70,6 @@ abstract class Doctrine_Hydrator_Abstract
$this->_nullObject = Doctrine_Null::$INSTANCE; $this->_nullObject = Doctrine_Null::$INSTANCE;
} }
/** /**
* setHydrationMode * setHydrationMode
* *
...@@ -85,7 +83,6 @@ abstract class Doctrine_Hydrator_Abstract ...@@ -85,7 +83,6 @@ abstract class Doctrine_Hydrator_Abstract
$this->_hydrationMode = $hydrationMode; $this->_hydrationMode = $hydrationMode;
} }
/** /**
* setQueryComponents * setQueryComponents
* *
...@@ -98,7 +95,6 @@ abstract class Doctrine_Hydrator_Abstract ...@@ -98,7 +95,6 @@ abstract class Doctrine_Hydrator_Abstract
$this->_queryComponents = $queryComponents; $this->_queryComponents = $queryComponents;
} }
/** /**
* getQueryComponents * getQueryComponents
* *
...@@ -111,7 +107,6 @@ abstract class Doctrine_Hydrator_Abstract ...@@ -111,7 +107,6 @@ abstract class Doctrine_Hydrator_Abstract
return $this->_queryComponents; return $this->_queryComponents;
} }
/** /**
* setTableAliasMap * setTableAliasMap
* *
...@@ -124,7 +119,6 @@ abstract class Doctrine_Hydrator_Abstract ...@@ -124,7 +119,6 @@ abstract class Doctrine_Hydrator_Abstract
$this->_tableAliasMap = $tableAliasMap; $this->_tableAliasMap = $tableAliasMap;
} }
/** /**
* getTableAliasMap * getTableAliasMap
* *
...@@ -137,7 +131,6 @@ abstract class Doctrine_Hydrator_Abstract ...@@ -137,7 +131,6 @@ abstract class Doctrine_Hydrator_Abstract
return $this->_tableAliasMap; return $this->_tableAliasMap;
} }
/** /**
* hydrateResultSet * hydrateResultSet
* *
......
...@@ -20,16 +20,14 @@ ...@@ -20,16 +20,14 @@
*/ */
/** /**
* Doctrine_Hydrator_ArrayDriver * Defines an array hydration strategy.
* Defines an array fetching strategy.
* *
* @package Doctrine
* @subpackage Hydrate
* @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$ * @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class Doctrine_Hydrator_ArrayDriver class Doctrine_Hydrator_ArrayDriver
{ {
...@@ -50,14 +48,6 @@ class Doctrine_Hydrator_ArrayDriver ...@@ -50,14 +48,6 @@ class Doctrine_Hydrator_ArrayDriver
return $data; return $data;
} }
/**
*
*/
/*public function isIdentifiable(array $data, Doctrine_Table $table)
{
return ( ! empty($data));
}*/
/** /**
* *
*/ */
......
...@@ -20,17 +20,15 @@ ...@@ -20,17 +20,15 @@
*/ */
/** /**
* Doctrine_Hydrator_RecordDriver * Hydration strategy used for creating graphs of entities.
* Hydration strategy used for creating graphs of entity objects.
* *
* @package Doctrine
* @subpackage Hydrate
* @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$ * @version $Revision$
* @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>
* @todo Rename to ObjectDriver
*/ */
class Doctrine_Hydrator_RecordDriver class Doctrine_Hydrator_RecordDriver
{ {
......
...@@ -170,10 +170,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract ...@@ -170,10 +170,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
$nonemptyComponents = array(); $nonemptyComponents = array();
$rowData = $this->_gatherRowData($data, $cache, $id, $nonemptyComponents); $rowData = $this->_gatherRowData($data, $cache, $id, $nonemptyComponents);
// 2) Hydrate the data of the root entity from the current row // 2) Hydrate the data of the root entity from the current row
//$class = $this->_queryComponents[$rootAlias]['metadata'];
//$entityName = $class->getComponentName();
// Check for an existing element // Check for an existing element
$index = false; $index = false;
if ($isSimpleQuery || ! isset($identifierMap[$rootAlias][$id[$rootAlias]])) { if ($isSimpleQuery || ! isset($identifierMap[$rootAlias][$id[$rootAlias]])) {
...@@ -208,7 +205,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract ...@@ -208,7 +205,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
} }
// 3) Now hydrate the rest of the data found in the current row, that // 3) Now hydrate the rest of the data found in the current row, that
// belongs to other (related) Entities. // belongs to other (related) entities.
foreach ($rowData as $dqlAlias => $data) { foreach ($rowData as $dqlAlias => $data) {
$index = false; $index = false;
$map = $this->_queryComponents[$dqlAlias]; $map = $this->_queryComponents[$dqlAlias];
...@@ -295,7 +292,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract ...@@ -295,7 +292,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
/** /**
* Updates the result pointer for an Entity. The result pointers point to the * Updates the result pointer for an Entity. The result pointers point to the
* last seen instance of each Entity. This is used for graph construction. * last seen instance of each Entity type. This is used for graph construction.
* *
* @param array $resultPointers The result pointers. * @param array $resultPointers The result pointers.
* @param array|Collection $coll The element. * @param array|Collection $coll The element.
...@@ -540,13 +537,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract ...@@ -540,13 +537,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
case 'enum': case 'enum':
case 'boolean': case 'boolean':
// don't do any conversions on primitive types // don't do any conversions on primitive types
break; break;
//case 'enum':
// return $class->enumValue($fieldName, $value);
//break;
//case 'boolean':
// return (boolean) $value;
//break;
case 'array': case 'array':
case 'object': case 'object':
if (is_string($value)) { if (is_string($value)) {
...@@ -556,14 +547,14 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract ...@@ -556,14 +547,14 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
} }
return $value; return $value;
} }
break; break;
case 'gzip': case 'gzip':
$value = gzuncompress($value); $value = gzuncompress($value);
if ($value === false) { if ($value === false) {
throw new Doctrine_Hydrator_Exception('Uncompressing of ' . $fieldName . ' failed.'); throw new Doctrine_Hydrator_Exception('Uncompressing of ' . $fieldName . ' failed.');
} }
return $value; return $value;
break; break;
} }
} }
return $value; return $value;
......
<?php <?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal; #namespace Doctrine::ORM::Internal;
......
<?php <?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal; #namespace Doctrine::ORM::Internal;
#use Doctrine::ORM::Mapping::ClassMetadata;
/** /**
* A CommitOrderNode is a temporary wrapper around ClassMetadata objects * A CommitOrderNode is a temporary wrapper around ClassMetadata objects
* that is used to sort the order of commits. * that is used to sort the order of commits.
...@@ -123,7 +140,7 @@ class Doctrine_Internal_CommitOrderNode ...@@ -123,7 +140,7 @@ class Doctrine_Internal_CommitOrderNode
} }
/** /**
* Adds a directed dependency (an edge). "$this -before-> $other". * Adds a directed dependency (an edge on the graph). "$this -before-> $other".
* *
* @param Doctrine_Internal_CommitOrderNode $node * @param Doctrine_Internal_CommitOrderNode $node
*/ */
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
*/ */
/** /**
* Doctrine_Sequence
* The base class for sequence handling drivers. * The base class for sequence handling drivers.
* *
* @package Doctrine * @package Doctrine
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +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::Sequences;
/** /**
* Doctrine_Sequence_Mysql * Doctrine_Sequence_Mysql
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* 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>.
*/ */
Doctrine::autoload('Doctrine_Transaction');
/** /**
* *
* @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
......
...@@ -32,7 +32,7 @@ class Orm_UnitOfWorkTest extends Doctrine_OrmTestCase ...@@ -32,7 +32,7 @@ class Orm_UnitOfWorkTest extends Doctrine_OrmTestCase
$this->_user->username = 'romanb'; $this->_user->username = 'romanb';
$this->_connectionMock = new Doctrine_ConnectionMock(array()); $this->_connectionMock = new Doctrine_ConnectionMock(array());
$this->_sequenceMock = $this->_connectionMock->getSequenceModule(); $this->_sequenceMock = $this->_connectionMock->getSequenceManager();
$this->_emMock = new Doctrine_EntityManagerMock($this->_connectionMock); $this->_emMock = new Doctrine_EntityManagerMock($this->_connectionMock);
$this->_persisterMock = $this->_emMock->getEntityPersister("ForumUser"); $this->_persisterMock = $this->_emMock->getEntityPersister("ForumUser");
$this->_unitOfWork = $this->_emMock->getUnitOfWork(); $this->_unitOfWork = $this->_emMock->getUnitOfWork();
......
...@@ -7,7 +7,7 @@ class Doctrine_ConnectionMock extends Doctrine_Connection ...@@ -7,7 +7,7 @@ class Doctrine_ConnectionMock extends Doctrine_Connection
protected $_driverName = 'Mysql'; protected $_driverName = 'Mysql';
private $_sequenceModuleMock; private $_sequenceModuleMock;
public function getSequenceModule() public function getSequenceManager()
{ {
if ( ! $this->_sequenceModuleMock) { if ( ! $this->_sequenceModuleMock) {
$this->_sequenceModuleMock = new Doctrine_SequenceMock($this); $this->_sequenceModuleMock = new Doctrine_SequenceMock($this);
......
...@@ -18,7 +18,7 @@ class CmsArticle extends Doctrine_Entity ...@@ -18,7 +18,7 @@ class CmsArticle extends Doctrine_Entity
'type' => 'integer', 'type' => 'integer',
'length' => 4, 'length' => 4,
'id' => true, 'id' => true,
'generatorType' => 'auto' 'idGenerator' => 'auto'
)); ));
$mapping->mapField(array( $mapping->mapField(array(
'fieldName' => 'topic', 'fieldName' => 'topic',
......
...@@ -18,7 +18,7 @@ class CmsUser extends Doctrine_Entity ...@@ -18,7 +18,7 @@ class CmsUser extends Doctrine_Entity
'type' => 'integer', 'type' => 'integer',
'length' => 4, 'length' => 4,
'id' => true, 'id' => true,
'generatorType' => 'auto' 'idGenerator' => 'auto'
)); ));
$mapping->mapField(array( $mapping->mapField(array(
'fieldName' => 'status', 'fieldName' => 'status',
......
...@@ -16,7 +16,7 @@ class ForumEntry extends Doctrine_Entity ...@@ -16,7 +16,7 @@ class ForumEntry extends Doctrine_Entity
'type' => 'integer', 'type' => 'integer',
'length' => 4, 'length' => 4,
'id' => true, 'id' => true,
'generatorType' => 'auto' 'idGenerator' => 'auto'
)); ));
$mapping->mapField(array( $mapping->mapField(array(
'fieldName' => 'topic', 'fieldName' => 'topic',
......
...@@ -34,7 +34,7 @@ class ForumUser extends Doctrine_Entity ...@@ -34,7 +34,7 @@ class ForumUser extends Doctrine_Entity
'type' => 'integer', 'type' => 'integer',
'length' => 4, 'length' => 4,
'id' => true, 'id' => true,
'generatorType' => 'auto' 'idGenerator' => 'auto'
)); ));
$mapping->mapField(array( $mapping->mapField(array(
'fieldName' => 'username', 'fieldName' => 'username',
......
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