Commit e79c45f9 authored by romanb's avatar romanb

[2.0] Fixed issues discovered during code coverage report generation. Made all...

[2.0] Fixed issues discovered during code coverage report generation. Made all ClassMetadata properties public (good reasons, read the class docblock). Performance improvements.
parent 8d956442
...@@ -7,7 +7,7 @@ class DoctrineException extends \Exception ...@@ -7,7 +7,7 @@ class DoctrineException extends \Exception
private $_innerException; private $_innerException;
private static $_messages = array(); private static $_messages = array();
public function __construct($message = "", Exception $innerException = null) public function __construct($message = "", \Exception $innerException = null)
{ {
parent::__construct($message); parent::__construct($message);
$this->_innerException = $innerException; $this->_innerException = $innerException;
...@@ -29,7 +29,7 @@ class DoctrineException extends \Exception ...@@ -29,7 +29,7 @@ class DoctrineException extends \Exception
$messageKey = substr($class, strrpos($class, '\\') + 1) . "#$method"; $messageKey = substr($class, strrpos($class, '\\') + 1) . "#$method";
$end = end($arguments); $end = end($arguments);
if ($end instanceof Exception) { if ($end instanceof \Exception) {
$this->_innerException = $end; $this->_innerException = $end;
unset($arguments[count($arguments) - 1]); unset($arguments[count($arguments) - 1]);
} }
......
...@@ -564,7 +564,7 @@ class Connection ...@@ -564,7 +564,7 @@ class Connection
* *
* @throws Doctrine\DBAL\ConnectionException * @throws Doctrine\DBAL\ConnectionException
*/ */
public function rethrowException(Exception $e, $invoker) public function rethrowException(\Exception $e, $invoker)
{ {
throw $e; throw $e;
} }
......
...@@ -51,8 +51,8 @@ abstract class Type ...@@ -51,8 +51,8 @@ abstract class Type
public static function getType($name) public static function getType($name)
{ {
if (is_object($name)) { if (is_object($name)) {
try { throw new Exception(); } try { throw new \Exception(); }
catch (Exception $e) { echo $e->getTraceAsString(); } catch (\Exception $e) { echo $e->getTraceAsString(); }
die(); die();
} }
if ( ! isset(self::$_typeObjects[$name])) { if ( ! isset(self::$_typeObjects[$name])) {
......
...@@ -98,7 +98,7 @@ class DynamicProxyGenerator ...@@ -98,7 +98,7 @@ class DynamicProxyGenerator
$file = self::$_proxyClassTemplate; $file = self::$_proxyClassTemplate;
$methods = ''; $methods = '';
foreach ($class->getReflectionClass()->getMethods() as $method) { foreach ($class->reflClass->getMethods() as $method) {
if ($method->isPublic() && ! $method->isFinal()) { if ($method->isPublic() && ! $method->isFinal()) {
$methods .= PHP_EOL . 'public function ' . $method->getName() . '('; $methods .= PHP_EOL . 'public function ' . $method->getName() . '(';
$firstParam = true; $firstParam = true;
...@@ -119,7 +119,7 @@ class DynamicProxyGenerator ...@@ -119,7 +119,7 @@ class DynamicProxyGenerator
} }
$sleepImpl = ''; $sleepImpl = '';
if ($class->getReflectionClass()->hasMethod('__sleep')) { if ($class->reflClass->hasMethod('__sleep')) {
$sleepImpl .= 'return parent::__sleep();'; $sleepImpl .= 'return parent::__sleep();';
} else { } else {
$sleepImpl .= 'return array('; $sleepImpl .= 'return array(';
...@@ -162,7 +162,7 @@ class DynamicProxyGenerator ...@@ -162,7 +162,7 @@ class DynamicProxyGenerator
$file = self::$_assocProxyClassTemplate; $file = self::$_assocProxyClassTemplate;
$methods = ''; $methods = '';
foreach ($class->getReflectionClass()->getMethods() as $method) { foreach ($class->reflClass->getMethods() as $method) {
if ($method->isPublic() && ! $method->isFinal()) { if ($method->isPublic() && ! $method->isFinal()) {
$methods .= PHP_EOL . 'public function ' . $method->getName() . '('; $methods .= PHP_EOL . 'public function ' . $method->getName() . '(';
$firstParam = true; $firstParam = true;
...@@ -183,7 +183,7 @@ class DynamicProxyGenerator ...@@ -183,7 +183,7 @@ class DynamicProxyGenerator
} }
$sleepImpl = ''; $sleepImpl = '';
if ($class->getReflectionClass()->hasMethod('__sleep')) { if ($class->reflClass->hasMethod('__sleep')) {
$sleepImpl .= 'return parent::__sleep();'; $sleepImpl .= 'return parent::__sleep();';
} else { } else {
$sleepImpl .= 'return array('; $sleepImpl .= 'return array(';
...@@ -228,7 +228,7 @@ namespace Doctrine\Generated\Proxies { ...@@ -228,7 +228,7 @@ namespace Doctrine\Generated\Proxies {
} }
private function _load() { private function _load() {
if ( ! $this->_loaded) { if ( ! $this->_loaded) {
$this->_em->getUnitOfWork()->getEntityPersister($this->_class->getClassName())->load($this->_identifier, $this); $this->_em->getUnitOfWork()->getEntityPersister($this->_class->name)->load($this->_identifier, $this);
unset($this->_em); unset($this->_em);
unset($this->_class); unset($this->_class);
$this->_loaded = true; $this->_loaded = true;
......
...@@ -40,7 +40,7 @@ class EntityRepository ...@@ -40,7 +40,7 @@ class EntityRepository
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->name;
$this->_em = $em; $this->_em = $em;
$this->_classMetadata = $classMetadata; $this->_classMetadata = $classMetadata;
} }
...@@ -66,7 +66,7 @@ class EntityRepository ...@@ -66,7 +66,7 @@ class EntityRepository
*/ */
public function clear() public function clear()
{ {
$this->_em->getUnitOfWork()->clearIdentitiesForEntity($this->_classMetadata->getRootClassName()); $this->_em->getUnitOfWork()->clearIdentitiesForEntity($this->_classMetadata->rootEntityName);
} }
/** /**
...@@ -79,13 +79,13 @@ class EntityRepository ...@@ -79,13 +79,13 @@ class EntityRepository
public function find($id, $hydrationMode = null) public function find($id, $hydrationMode = null)
{ {
// Check identity map first // Check identity map first
if ($entity = $this->_em->getUnitOfWork()->tryGetById($id, $this->_classMetadata->getRootClassName())) { if ($entity = $this->_em->getUnitOfWork()->tryGetById($id, $this->_classMetadata->rootEntityName)) {
return $entity; // Hit! return $entity; // Hit!
} }
if ( ! is_array($id) || count($id) <= 1) { if ( ! is_array($id) || count($id) <= 1) {
$value = is_array($id) ? array_values($id) : array($id); $value = is_array($id) ? array_values($id) : array($id);
$id = array_combine($this->_classMetadata->getIdentifier(), $value); $id = array_combine($this->_classMetadata->identifier, $value);
} }
return $this->_em->getUnitOfWork()->getEntityPersister($this->_entityName)->load($id); return $this->_em->getUnitOfWork()->getEntityPersister($this->_entityName)->load($id);
......
...@@ -143,7 +143,7 @@ abstract class AbstractHydrator ...@@ -143,7 +143,7 @@ abstract class AbstractHydrator
*/ */
protected function _hydrateRow(array &$data, array &$cache, &$result) protected function _hydrateRow(array &$data, array &$cache, &$result)
{ {
throw new Exception("_hydrateRow() not implemented for this hydrator."); throw new DoctrineException("_hydrateRow() not implemented for this hydrator.");
} }
/** /**
...@@ -312,7 +312,7 @@ abstract class AbstractHydrator ...@@ -312,7 +312,7 @@ abstract class AbstractHydrator
return $class; return $class;
} }
foreach ($class->getSubclasses() as $subClass) { foreach ($class->subClasses as $subClass) {
$subClassMetadata = $this->_em->getClassMetadata($subClass); $subClassMetadata = $this->_em->getClassMetadata($subClass);
if ($subClassMetadata->hasField($fieldName)) { if ($subClassMetadata->hasField($fieldName)) {
return $subClassMetadata; return $subClassMetadata;
......
...@@ -63,14 +63,14 @@ class ObjectHydrator extends AbstractHydrator ...@@ -63,14 +63,14 @@ class ObjectHydrator extends AbstractHydrator
$this->_identifierMap[$dqlAlias] = array(); $this->_identifierMap[$dqlAlias] = array();
$this->_resultPointers[$dqlAlias] = array(); $this->_resultPointers[$dqlAlias] = array();
$this->_idTemplate[$dqlAlias] = ''; $this->_idTemplate[$dqlAlias] = '';
$this->_classMetadatas[$class->getClassName()] = $class; $this->_classMetadatas[$class->name] = $class;
if ($class->isInheritanceTypeSingleTable() || $class->isInheritanceTypeJoined()) { if ($class->isInheritanceTypeSingleTable() || $class->isInheritanceTypeJoined()) {
$this->_discriminatorMap[$class->getClassName()][$class->getDiscriminatorValue()] = $class->getClassName(); $this->_discriminatorMap[$class->name][$class->discriminatorValue] = $class->name;
foreach (array_merge($class->getParentClasses(), $class->getSubclasses()) as $className) { foreach (array_merge($class->parentClasses, $class->subClasses) as $className) {
$otherClass = $this->_em->getClassMetadata($className); $otherClass = $this->_em->getClassMetadata($className);
$value = $otherClass->getDiscriminatorValue(); $value = $otherClass->discriminatorValue;
$this->_classMetadatas[$className] = $otherClass; $this->_classMetadatas[$className] = $otherClass;
$this->_discriminatorMap[$class->getClassName()][$value] = $className; $this->_discriminatorMap[$class->name][$value] = $className;
} }
} }
if ($this->_resultSetMapping->isRelation($dqlAlias)) { if ($this->_resultSetMapping->isRelation($dqlAlias)) {
...@@ -79,7 +79,7 @@ class ObjectHydrator extends AbstractHydrator ...@@ -79,7 +79,7 @@ class ObjectHydrator extends AbstractHydrator
if ($mappedByField = $assoc->getMappedByFieldName()) { if ($mappedByField = $assoc->getMappedByFieldName()) {
$this->_fetchedAssociations[$assoc->getTargetEntityName()][$mappedByField] = true; $this->_fetchedAssociations[$assoc->getTargetEntityName()][$mappedByField] = true;
} else if ($inverseAssoc = $this->_em->getClassMetadata($assoc->getTargetEntityName()) } else if ($inverseAssoc = $this->_em->getClassMetadata($assoc->getTargetEntityName())
->getInverseAssociationMapping($assoc->getSourceFieldName())) { ->inverseMappings[$assoc->getSourceFieldName()]) {
$this->_fetchedAssociations[$assoc->getTargetEntityName()][ $this->_fetchedAssociations[$assoc->getTargetEntityName()][
$inverseAssoc->getSourceFieldName() $inverseAssoc->getSourceFieldName()
] = true; ] = true;
...@@ -188,7 +188,7 @@ class ObjectHydrator extends AbstractHydrator ...@@ -188,7 +188,7 @@ class ObjectHydrator extends AbstractHydrator
$coll = $this->getCollection($relatedClass); $coll = $this->getCollection($relatedClass);
$coll->setOwner($entity, $relation); $coll->setOwner($entity, $relation);
$classMetadata->getReflectionProperty($name)->setValue($entity, $coll); $classMetadata->reflFields[$name]->setValue($entity, $coll);
$this->_uow->setOriginalEntityProperty($oid, $name, $coll); $this->_uow->setOriginalEntityProperty($oid, $name, $coll);
$this->_initializedRelations[$oid][$name] = true; $this->_initializedRelations[$oid][$name] = true;
...@@ -206,7 +206,7 @@ class ObjectHydrator extends AbstractHydrator ...@@ -206,7 +206,7 @@ class ObjectHydrator extends AbstractHydrator
private function isIndexKeyInUse($entity, $assocField, $indexField) private function isIndexKeyInUse($entity, $assocField, $indexField)
{ {
return $this->_classMetadatas[get_class($entity)] return $this->_classMetadatas[get_class($entity)]
->getReflectionProperty($assocField) ->reflFields[$assocField]
->getValue($entity) ->getValue($entity)
->containsKey($indexField); ->containsKey($indexField);
} }
...@@ -234,7 +234,7 @@ class ObjectHydrator extends AbstractHydrator ...@@ -234,7 +234,7 @@ class ObjectHydrator extends AbstractHydrator
// Properly initialize any unfetched associations, if partial objects are not allowed. // Properly initialize any unfetched associations, if partial objects are not allowed.
if ( ! $this->_allowPartialObjects) { if ( ! $this->_allowPartialObjects) {
foreach ($this->_classMetadatas[$className]->getAssociationMappings() as $field => $assoc) { foreach ($this->_classMetadatas[$className]->associationMappings as $field => $assoc) {
if ( ! isset($this->_fetchedAssociations[$className][$field])) { if ( ! isset($this->_fetchedAssociations[$className][$field])) {
if ($assoc->isOneToOne()) { if ($assoc->isOneToOne()) {
if ($assoc->isLazilyFetched()) { if ($assoc->isLazilyFetched()) {
...@@ -246,7 +246,7 @@ class ObjectHydrator extends AbstractHydrator ...@@ -246,7 +246,7 @@ class ObjectHydrator extends AbstractHydrator
} }
} else { } else {
// Inject collection // Inject collection
$this->_classMetadatas[$className]->getReflectionProperty($field) $this->_classMetadatas[$className]->reflFields[$field]
->setValue($entity, new PersistentCollection($this->_em, ->setValue($entity, new PersistentCollection($this->_em,
$this->_em->getClassMetadata($assoc->getTargetEntityName()) $this->_em->getClassMetadata($assoc->getTargetEntityName())
)); ));
...@@ -268,7 +268,7 @@ class ObjectHydrator extends AbstractHydrator ...@@ -268,7 +268,7 @@ class ObjectHydrator extends AbstractHydrator
private function isFieldSet($entity, $field) private function isFieldSet($entity, $field)
{ {
return $this->_classMetadatas[get_class($entity)] return $this->_classMetadatas[get_class($entity)]
->getReflectionProperty($field) ->reflFields[$field]
->getValue($entity) !== null; ->getValue($entity) !== null;
} }
...@@ -282,7 +282,7 @@ class ObjectHydrator extends AbstractHydrator ...@@ -282,7 +282,7 @@ class ObjectHydrator extends AbstractHydrator
private function setRelatedElement($entity1, $property, $entity2) private function setRelatedElement($entity1, $property, $entity2)
{ {
$classMetadata1 = $this->_classMetadatas[get_class($entity1)]; $classMetadata1 = $this->_classMetadatas[get_class($entity1)];
$classMetadata1->getReflectionProperty($property)->setValue($entity1, $entity2); $classMetadata1->reflFields[$property]->setValue($entity1, $entity2);
$this->_uow->setOriginalEntityProperty(spl_object_hash($entity1), $property, $entity2); $this->_uow->setOriginalEntityProperty(spl_object_hash($entity1), $property, $entity2);
$relation = $classMetadata1->getAssociationMapping($property); $relation = $classMetadata1->getAssociationMapping($property);
if ($relation->isOneToOne()) { if ($relation->isOneToOne()) {
...@@ -290,12 +290,12 @@ class ObjectHydrator extends AbstractHydrator ...@@ -290,12 +290,12 @@ class ObjectHydrator extends AbstractHydrator
if ($relation->isOwningSide()) { if ($relation->isOwningSide()) {
// If there is an inverse mapping on the target class its bidirectional // If there is an inverse mapping on the target class its bidirectional
if ($targetClass->hasInverseAssociationMapping($property)) { if ($targetClass->hasInverseAssociationMapping($property)) {
$sourceProp = $targetClass->getInverseAssociationMapping($fieldName)->getSourceFieldName(); $sourceProp = $targetClass->inverseMappings[$fieldName]->getSourceFieldName();
$targetClass->getReflectionProperty($sourceProp)->setValue($entity2, $entity1); $targetClass->reflFields[$sourceProp]->setValue($entity2, $entity1);
} }
} else { } else {
// For sure bidirectional, as there is no inverse side in unidirectional // For sure bidirectional, as there is no inverse side in unidirectional
$targetClass->getReflectionProperty($relation->getMappedByFieldName())->setValue($entity2, $entity1); $targetClass->reflFields[$relation->getMappedByFieldName()]->setValue($entity2, $entity1);
} }
} }
} }
...@@ -321,7 +321,7 @@ class ObjectHydrator extends AbstractHydrator ...@@ -321,7 +321,7 @@ class ObjectHydrator extends AbstractHydrator
// Hydrate the entity data found in the current row. // Hydrate the entity data found in the current row.
foreach ($rowData as $dqlAlias => $data) { foreach ($rowData as $dqlAlias => $data) {
$index = false; $index = false;
$entityName = $this->_resultSetMapping->getClass($dqlAlias)->getClassName(); $entityName = $this->_resultSetMapping->getClass($dqlAlias)->name;
if ($this->_resultSetMapping->hasParentAlias($dqlAlias)) { if ($this->_resultSetMapping->hasParentAlias($dqlAlias)) {
// It's a joined result // It's a joined result
...@@ -363,7 +363,7 @@ class ObjectHydrator extends AbstractHydrator ...@@ -363,7 +363,7 @@ class ObjectHydrator extends AbstractHydrator
if ($relation->isManyToMany()) { if ($relation->isManyToMany()) {
if ($relation->isOwningSide()) { if ($relation->isOwningSide()) {
$reverseAssoc = $this->_classMetadatas[$entityName] $reverseAssoc = $this->_classMetadatas[$entityName]
->getInverseAssociationMapping($relationAlias); ->inverseMappings[$relationAlias];
if ($reverseAssoc) { if ($reverseAssoc) {
$this->initRelatedCollection($element, $reverseAssoc->getSourceFieldName()); $this->initRelatedCollection($element, $reverseAssoc->getSourceFieldName());
} }
...@@ -374,21 +374,21 @@ class ObjectHydrator extends AbstractHydrator ...@@ -374,21 +374,21 @@ class ObjectHydrator extends AbstractHydrator
if ($field = $this->_getCustomIndexField($dqlAlias)) { if ($field = $this->_getCustomIndexField($dqlAlias)) {
$indexValue = $this->_classMetadatas[$entityName] $indexValue = $this->_classMetadatas[$entityName]
->getReflectionProperty($field) ->reflFields[$field]
->getValue($element); ->getValue($element);
$this->_classMetadatas[$parentClass] $this->_classMetadatas[$parentClass]
->getReflectionProperty($relationAlias) ->reflFields[$relationAlias]
->getValue($baseElement) ->getValue($baseElement)
->set($indexValue, $element); ->set($indexValue, $element);
} else { } else {
$this->_classMetadatas[$parentClass] $this->_classMetadatas[$parentClass]
->getReflectionProperty($relationAlias) ->reflFields[$relationAlias]
->getValue($baseElement) ->getValue($baseElement)
->add($element); ->add($element);
} }
$this->_identifierMap[$path][$id[$parent]][$id[$dqlAlias]] = $this->getLastKey( $this->_identifierMap[$path][$id[$parent]][$id[$dqlAlias]] = $this->getLastKey(
$this->_classMetadatas[$parentClass] $this->_classMetadatas[$parentClass]
->getReflectionProperty($relationAlias) ->reflFields[$relationAlias]
->getValue($baseElement) ->getValue($baseElement)
); );
} }
...@@ -406,7 +406,7 @@ class ObjectHydrator extends AbstractHydrator ...@@ -406,7 +406,7 @@ class ObjectHydrator extends AbstractHydrator
} }
$coll = $this->_classMetadatas[$parentClass] $coll = $this->_classMetadatas[$parentClass]
->getReflectionProperty($relationAlias) ->reflFields[$relationAlias]
->getValue($baseElement); ->getValue($baseElement);
if ($coll !== null) { if ($coll !== null) {
...@@ -423,13 +423,13 @@ class ObjectHydrator extends AbstractHydrator ...@@ -423,13 +423,13 @@ class ObjectHydrator extends AbstractHydrator
if ($this->_resultSetMapping->isMixedResult()) { if ($this->_resultSetMapping->isMixedResult()) {
$result[] = array( $result[] = array(
$this->_classMetadatas[$entityName] $this->_classMetadatas[$entityName]
->getReflectionProperty($field) ->reflFields[$field]
->getValue($element) => $element ->getValue($element) => $element
); );
++$this->_resultCounter; ++$this->_resultCounter;
} else { } else {
$result->set($element, $this->_classMetadatas[$entityName] $result->set($element, $this->_classMetadatas[$entityName]
->getReflectionProperty($field) ->reflFields[$field]
->getValue($element)); ->getValue($element));
} }
} else { } else {
......
...@@ -28,6 +28,16 @@ use Doctrine\Common\DoctrineException; ...@@ -28,6 +28,16 @@ use Doctrine\Common\DoctrineException;
* A <tt>ClassMetadata</tt> instance holds all the ORM metadata of an entity and * A <tt>ClassMetadata</tt> instance holds all the ORM metadata of an entity and
* it's associations. It is the backbone of Doctrine's metadata mapping. * it's associations. It is the backbone of Doctrine's metadata mapping.
* *
* <b>IMPORTANT NOTE:</b>
*
* The fields of this class are only public for 2 reasons:
* 1) To allow fast READ access.
* 2) To drastically reduce the size of a serialized instance (private/protected members
* get the whole class name, namespace inclusive, prepended to every property in
* the serialized representation).
*
* !! Do NOT write/modify the public properties directly. Go through the public API. !!
*
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @since 2.0 * @since 2.0
*/ */
...@@ -108,14 +118,14 @@ final class ClassMetadata ...@@ -108,14 +118,14 @@ final class ClassMetadata
/** /**
* The name of the entity class. * The name of the entity class.
*/ */
private $_entityName; public $name;
/** /**
* The namespace the entity class is contained in. * The namespace the entity class is contained in.
* *
* @var string * @var string
*/ */
private $_namespace; public $namespace;
/** /**
* The name of the entity class that is at the root of the entity inheritance * The name of the entity class that is at the root of the entity inheritance
...@@ -124,7 +134,7 @@ final class ClassMetadata ...@@ -124,7 +134,7 @@ final class ClassMetadata
* *
* @var string * @var string
*/ */
private $_rootEntityName; public $rootEntityName;
/** /**
* The name of the custom repository class used for the entity class. * The name of the custom repository class used for the entity class.
...@@ -132,21 +142,21 @@ final class ClassMetadata ...@@ -132,21 +142,21 @@ final class ClassMetadata
* *
* @var string * @var string
*/ */
private $_customRepositoryClassName; public $customRepositoryClassName;
/** /**
* The names of the parent classes (ancestors). * The names of the parent classes (ancestors).
* *
* @var array * @var array
*/ */
private $_parentClasses = array(); public $parentClasses = array();
/** /**
* The names of all subclasses. * The names of all subclasses.
* *
* @var array * @var array
*/ */
private $_subClasses = array(); public $subClasses = array();
/** /**
* The field names of all fields that are part of the identifier/primary key * The field names of all fields that are part of the identifier/primary key
...@@ -154,21 +164,21 @@ final class ClassMetadata ...@@ -154,21 +164,21 @@ final class ClassMetadata
* *
* @var array * @var array
*/ */
private $_identifier = array(); public $identifier = array();
/** /**
* The inheritance mapping type used by the class. * The inheritance mapping type used by the class.
* *
* @var integer * @var integer
*/ */
private $_inheritanceType = self::INHERITANCE_TYPE_NONE; public $inheritanceType = self::INHERITANCE_TYPE_NONE;
/** /**
* The Id generator type used by the class. * The Id generator type used by the class.
* *
* @var string * @var string
*/ */
private $_generatorType = self::GENERATOR_TYPE_NONE; public $generatorType = self::GENERATOR_TYPE_NONE;
/** /**
* The field mappings of the class. * The field mappings of the class.
...@@ -226,7 +236,7 @@ final class ClassMetadata ...@@ -226,7 +236,7 @@ final class ClassMetadata
* *
* @var array * @var array
*/ */
private $_fieldMappings = array(); public $fieldMappings = array();
/** /**
* An array of field names. Used to look up field names from column names. * An array of field names. Used to look up field names from column names.
...@@ -235,7 +245,7 @@ final class ClassMetadata ...@@ -235,7 +245,7 @@ final class ClassMetadata
* *
* @var array * @var array
*/ */
private $_fieldNames = array(); public $fieldNames = array();
/** /**
* An array of column names. Keys are field names and values column names. * An array of column names. Keys are field names and values column names.
...@@ -244,7 +254,7 @@ final class ClassMetadata ...@@ -244,7 +254,7 @@ final class ClassMetadata
* *
* @var array * @var array
*/ */
private $_columnNames = array(); public $columnNames = array();
/** /**
* Map that maps lowercased column names (keys) to field names (values). * Map that maps lowercased column names (keys) to field names (values).
...@@ -253,7 +263,7 @@ final class ClassMetadata ...@@ -253,7 +263,7 @@ final class ClassMetadata
* *
* @var array * @var array
*/ */
private $_lcColumnToFieldNames = array(); public $lcColumnToFieldNames = array();
/** /**
* Whether to automatically OUTER JOIN subtypes when a basetype is queried. * Whether to automatically OUTER JOIN subtypes when a basetype is queried.
...@@ -262,19 +272,18 @@ final class ClassMetadata ...@@ -262,19 +272,18 @@ final class ClassMetadata
* *
* @var boolean * @var boolean
*/ */
private $_joinSubclasses = true; public $joinSubclasses = true;
/** /**
* A map that maps discriminator values to class names. * The discriminator value of this class.
* *
* <b>This does only apply to the JOINED and SINGLE_TABLE inheritance mapping strategies * <b>This does only apply to the JOINED and SINGLE_TABLE inheritance mapping strategies
* where a discriminator column is used.</b> * where a discriminator column is used.</b>
* *
* @var array * @var mixed
* @see _discriminatorColumn * @see _discriminatorColumn
*/ */
//private $_discriminatorMap = array(); public $discriminatorValue;
private $_discriminatorValue;
/** /**
* The definition of the descriminator column used in JOINED and SINGLE_TABLE * The definition of the descriminator column used in JOINED and SINGLE_TABLE
...@@ -282,7 +291,7 @@ final class ClassMetadata ...@@ -282,7 +291,7 @@ final class ClassMetadata
* *
* @var array * @var array
*/ */
private $_discriminatorColumn; public $discriminatorColumn;
/** /**
* The primary table definition. The definition is an array with the * The primary table definition. The definition is an array with the
...@@ -294,7 +303,7 @@ final class ClassMetadata ...@@ -294,7 +303,7 @@ final class ClassMetadata
* *
* @var array * @var array
*/ */
private $_primaryTable; public $primaryTable;
/** /**
* The cached lifecycle listeners. There is only one instance of each * The cached lifecycle listeners. There is only one instance of each
...@@ -302,56 +311,56 @@ final class ClassMetadata ...@@ -302,56 +311,56 @@ final class ClassMetadata
* *
* @var array * @var array
*/ */
private $_lifecycleListenerInstances = array(); public $lifecycleListenerInstances = array();
/** /**
* The registered lifecycle callbacks for entities of this class. * The registered lifecycle callbacks for entities of this class.
* *
* @var array * @var array
*/ */
private $_lifecycleCallbacks = array(); public $lifecycleCallbacks = array();
/** /**
* The registered lifecycle listeners for entities of this class. * The registered lifecycle listeners for entities of this class.
* *
* @var array * @var array
*/ */
private $_lifecycleListeners = array(); public $lifecycleListeners = array();
/** /**
* The association mappings. All mappings, inverse and owning side. * The association mappings. All mappings, inverse and owning side.
* *
* @var array * @var array
*/ */
private $_associationMappings = array(); public $associationMappings = array();
/** /**
* List of inverse association mappings, indexed by mappedBy field name. * List of inverse association mappings, indexed by mappedBy field name.
* *
* @var array * @var array
*/ */
private $_inverseMappings = array(); public $inverseMappings = array();
/** /**
* Flag indicating whether the identifier/primary key of the class is composite. * Flag indicating whether the identifier/primary key of the class is composite.
* *
* @var boolean * @var boolean
*/ */
private $_isIdentifierComposite = false; public $isIdentifierComposite = false;
/** /**
* The ReflectionClass instance of the mapped class. * The ReflectionClass instance of the mapped class.
* *
* @var ReflectionClass * @var ReflectionClass
*/ */
private $_reflectionClass; public $reflClass;
/** /**
* The ReflectionProperty instances of the mapped class. * The ReflectionProperty instances of the mapped class.
* *
* @var array * @var array
*/ */
private $_reflectionProperties; public $reflFields;
//private $_insertSql; //private $_insertSql;
...@@ -360,7 +369,7 @@ final class ClassMetadata ...@@ -360,7 +369,7 @@ final class ClassMetadata
* *
* @var AbstractIdGenerator * @var AbstractIdGenerator
*/ */
private $_idGenerator; public $idGenerator;
/** /**
* The definition of the sequence generator of this class. Only used for the * The definition of the sequence generator of this class. Only used for the
...@@ -368,7 +377,7 @@ final class ClassMetadata ...@@ -368,7 +377,7 @@ final class ClassMetadata
* *
* @var array * @var array
*/ */
private $_sequenceGeneratorDefinition; public $sequenceGeneratorDefinition;
/** /**
* The definition of the table generator of this class. Only used for the * The definition of the table generator of this class. Only used for the
...@@ -383,7 +392,7 @@ final class ClassMetadata ...@@ -383,7 +392,7 @@ final class ClassMetadata
* *
* @var integer * @var integer
*/ */
private $_changeTrackingPolicy = self::CHANGETRACKING_DEFERRED_IMPLICIT; public $changeTrackingPolicy = self::CHANGETRACKING_DEFERRED_IMPLICIT;
/** /**
* Initializes a new ClassMetadata instance that will hold the object-relational mapping * Initializes a new ClassMetadata instance that will hold the object-relational mapping
...@@ -393,11 +402,11 @@ final class ClassMetadata ...@@ -393,11 +402,11 @@ final class ClassMetadata
*/ */
public function __construct($entityName) public function __construct($entityName)
{ {
$this->_entityName = $entityName; $this->name = $entityName;
$this->_namespace = substr($entityName, 0, strrpos($entityName, '\\')); $this->namespace = substr($entityName, 0, strrpos($entityName, '\\'));
$this->_primaryTable['name'] = str_replace($this->_namespace . '\\', '', $this->_entityName); $this->primaryTable['name'] = str_replace($this->namespace . '\\', '', $this->name);
$this->_rootEntityName = $entityName; $this->rootEntityName = $entityName;
$this->_reflectionClass = new ReflectionClass($entityName); $this->reflClass = new ReflectionClass($entityName);
} }
/** /**
...@@ -407,7 +416,7 @@ final class ClassMetadata ...@@ -407,7 +416,7 @@ final class ClassMetadata
*/ */
public function getReflectionClass() public function getReflectionClass()
{ {
return $this->_reflectionClass; return $this->reflClass;
} }
/** /**
...@@ -417,7 +426,7 @@ final class ClassMetadata ...@@ -417,7 +426,7 @@ final class ClassMetadata
*/ */
public function getReflectionProperties() public function getReflectionProperties()
{ {
return $this->_reflectionProperties; return $this->reflFields;
} }
/** /**
...@@ -427,7 +436,7 @@ final class ClassMetadata ...@@ -427,7 +436,7 @@ final class ClassMetadata
*/ */
public function getChangeTrackingPolicy() public function getChangeTrackingPolicy()
{ {
return $this->_changeTrackingPolicy; return $this->changeTrackingPolicy;
} }
/** /**
...@@ -437,7 +446,7 @@ final class ClassMetadata ...@@ -437,7 +446,7 @@ final class ClassMetadata
*/ */
public function setChangeTrackingPolicy($policy) public function setChangeTrackingPolicy($policy)
{ {
$this->_changeTrackingPolicy = $policy; $this->changeTrackingPolicy = $policy;
} }
/** /**
...@@ -447,7 +456,7 @@ final class ClassMetadata ...@@ -447,7 +456,7 @@ final class ClassMetadata
*/ */
public function isChangeTrackingDeferredExplicit() public function isChangeTrackingDeferredExplicit()
{ {
return $this->_changeTrackingPolicy == self::CHANGETRACKING_DEFERRED_EXPLICIT; return $this->changeTrackingPolicy == self::CHANGETRACKING_DEFERRED_EXPLICIT;
} }
/** /**
...@@ -455,9 +464,9 @@ final class ClassMetadata ...@@ -455,9 +464,9 @@ final class ClassMetadata
* *
* @return boolean * @return boolean
*/ */
public function isChangeTrackingPolicyDeferredImplicit() public function isChangeTrackingDeferredImplicit()
{ {
return $this->_changeTrackingPolicy == self::CHANGETRACKING_DEFERRED_IMPLICIT; return $this->changeTrackingPolicy == self::CHANGETRACKING_DEFERRED_IMPLICIT;
} }
/** /**
...@@ -467,7 +476,7 @@ final class ClassMetadata ...@@ -467,7 +476,7 @@ final class ClassMetadata
*/ */
public function isChangeTrackingNotify() public function isChangeTrackingNotify()
{ {
return $this->_changeTrackingPolicy == self::CHANGETRACKING_NOTIFY; return $this->changeTrackingPolicy == self::CHANGETRACKING_NOTIFY;
} }
/** /**
...@@ -479,7 +488,7 @@ final class ClassMetadata ...@@ -479,7 +488,7 @@ final class ClassMetadata
*/ */
public function addReflectionProperty($propName, \ReflectionProperty $property) public function addReflectionProperty($propName, \ReflectionProperty $property)
{ {
$this->_reflectionProperties[$propName] = $property; $this->reflFields[$propName] = $property;
} }
/** /**
...@@ -490,7 +499,7 @@ final class ClassMetadata ...@@ -490,7 +499,7 @@ final class ClassMetadata
*/ */
public function getReflectionProperty($name) public function getReflectionProperty($name)
{ {
return $this->_reflectionProperties[$name]; return $this->reflFields[$name];
} }
/** /**
...@@ -501,10 +510,10 @@ final class ClassMetadata ...@@ -501,10 +510,10 @@ final class ClassMetadata
*/ */
public function getSingleIdReflectionProperty() public function getSingleIdReflectionProperty()
{ {
if ($this->_isIdentifierComposite) { if ($this->isIdentifierComposite) {
throw DoctrineException::updateMe("getSingleIdReflectionProperty called on entity with composite key."); throw DoctrineException::updateMe("getSingleIdReflectionProperty called on entity with composite key.");
} }
return $this->_reflectionProperties[$this->_identifier[0]]; return $this->reflFields[$this->identifier[0]];
} }
/** /**
...@@ -514,7 +523,7 @@ final class ClassMetadata ...@@ -514,7 +523,7 @@ final class ClassMetadata
*/ */
public function getClassName() public function getClassName()
{ {
return $this->_entityName; return $this->name;
} }
/** /**
...@@ -526,8 +535,8 @@ final class ClassMetadata ...@@ -526,8 +535,8 @@ final class ClassMetadata
*/ */
public function getOwningClass($fieldName) public function getOwningClass($fieldName)
{ {
if ($this->_inheritanceType == self::INHERITANCE_TYPE_NONE) { if ($this->inheritanceType == self::INHERITANCE_TYPE_NONE) {
return $this->_entityName; return $this->name;
} else { } else {
$mapping = $this->getFieldMapping($fieldName); $mapping = $this->getFieldMapping($fieldName);
return $mapping['inherited']; return $mapping['inherited'];
...@@ -543,7 +552,7 @@ final class ClassMetadata ...@@ -543,7 +552,7 @@ final class ClassMetadata
*/ */
public function getRootClassName() public function getRootClassName()
{ {
return $this->_rootEntityName; return $this->rootEntityName;
} }
/** /**
...@@ -555,10 +564,10 @@ final class ClassMetadata ...@@ -555,10 +564,10 @@ final class ClassMetadata
*/ */
public function isIdentifier($fieldName) public function isIdentifier($fieldName)
{ {
if ( ! $this->_isIdentifierComposite) { if ( ! $this->isIdentifierComposite) {
return $fieldName === $this->_identifier[0]; return $fieldName === $this->identifier[0];
} }
return in_array($fieldName, $this->_identifier); return in_array($fieldName, $this->identifier);
} }
/** /**
...@@ -569,7 +578,7 @@ final class ClassMetadata ...@@ -569,7 +578,7 @@ final class ClassMetadata
*/ */
public function isIdentifierComposite() public function isIdentifierComposite()
{ {
return $this->_isIdentifierComposite; return $this->isIdentifierComposite;
} }
/** /**
...@@ -612,8 +621,8 @@ final class ClassMetadata ...@@ -612,8 +621,8 @@ final class ClassMetadata
*/ */
public function getColumnName($fieldName) public function getColumnName($fieldName)
{ {
return isset($this->_columnNames[$fieldName]) ? return isset($this->columnNames[$fieldName]) ?
$this->_columnNames[$fieldName] : $fieldName; $this->columnNames[$fieldName] : $fieldName;
} }
/** /**
...@@ -625,10 +634,10 @@ final class ClassMetadata ...@@ -625,10 +634,10 @@ final class ClassMetadata
*/ */
public function getFieldMapping($fieldName) public function getFieldMapping($fieldName)
{ {
if ( ! isset($this->_fieldMappings[$fieldName])) { if ( ! isset($this->fieldMappings[$fieldName])) {
throw MappingException::mappingNotFound($fieldName); throw MappingException::mappingNotFound($fieldName);
} }
return $this->_fieldMappings[$fieldName]; return $this->fieldMappings[$fieldName];
} }
/** /**
...@@ -640,10 +649,10 @@ final class ClassMetadata ...@@ -640,10 +649,10 @@ final class ClassMetadata
*/ */
public function getAssociationMapping($fieldName) public function getAssociationMapping($fieldName)
{ {
if ( ! isset($this->_associationMappings[$fieldName])) { if ( ! isset($this->associationMappings[$fieldName])) {
throw MappingException::mappingNotFound($fieldName); throw MappingException::mappingNotFound($fieldName);
} }
return $this->_associationMappings[$fieldName]; return $this->associationMappings[$fieldName];
} }
/** /**
...@@ -654,8 +663,7 @@ final class ClassMetadata ...@@ -654,8 +663,7 @@ final class ClassMetadata
*/ */
public function getInverseAssociationMapping($mappedByFieldName) public function getInverseAssociationMapping($mappedByFieldName)
{ {
return isset($this->_inverseMappings[$mappedByFieldName]) ? return $this->inverseMappings[$mappedByFieldName];
$this->_inverseMappings[$mappedByFieldName] : null;
} }
/** /**
...@@ -666,7 +674,7 @@ final class ClassMetadata ...@@ -666,7 +674,7 @@ final class ClassMetadata
*/ */
public function hasInverseAssociationMapping($mappedByFieldName) public function hasInverseAssociationMapping($mappedByFieldName)
{ {
return isset($this->_inverseMappings[$mappedByFieldName]); return isset($this->inverseMappings[$mappedByFieldName]);
} }
/** /**
...@@ -676,7 +684,7 @@ final class ClassMetadata ...@@ -676,7 +684,7 @@ final class ClassMetadata
*/ */
public function getAssociationMappings() public function getAssociationMappings()
{ {
return $this->_associationMappings; return $this->associationMappings;
} }
/** /**
...@@ -688,7 +696,7 @@ final class ClassMetadata ...@@ -688,7 +696,7 @@ final class ClassMetadata
*/ */
public function getAssociations() public function getAssociations()
{ {
return $this->_associationMappings; return $this->associationMappings;
} }
/** /**
...@@ -700,8 +708,8 @@ final class ClassMetadata ...@@ -700,8 +708,8 @@ final class ClassMetadata
*/ */
public function getFieldName($columnName) public function getFieldName($columnName)
{ {
return isset($this->_fieldNames[$columnName]) ? return isset($this->fieldNames[$columnName]) ?
$this->_fieldNames[$columnName] : $columnName; $this->fieldNames[$columnName] : $columnName;
} }
/** /**
...@@ -713,8 +721,7 @@ final class ClassMetadata ...@@ -713,8 +721,7 @@ final class ClassMetadata
*/ */
public function getFieldNameForLowerColumnName($lcColumnName) public function getFieldNameForLowerColumnName($lcColumnName)
{ {
return isset($this->_lcColumnToFieldNames[$lcColumnName]) ? return $this->lcColumnToFieldNames[$lcColumnName];
$this->_lcColumnToFieldNames[$lcColumnName] : $lcColumnName;
} }
/** /**
...@@ -725,7 +732,7 @@ final class ClassMetadata ...@@ -725,7 +732,7 @@ final class ClassMetadata
*/ */
public function hasLowerColumn($lcColumnName) public function hasLowerColumn($lcColumnName)
{ {
return isset($this->_lcColumnToFieldNames[$lcColumnName]); return isset($this->lcColumnToFieldNames[$lcColumnName]);
} }
/** /**
...@@ -744,35 +751,31 @@ final class ClassMetadata ...@@ -744,35 +751,31 @@ final class ClassMetadata
throw MappingException::missingType(); throw MappingException::missingType();
} }
/*if ( ! is_object($mapping['type'])) {
$mapping['type'] = \Doctrine\DBAL\Types\Type::getType($mapping['type']);
}*/
// Complete fieldName and columnName mapping // Complete fieldName and columnName mapping
if ( ! isset($mapping['columnName'])) { if ( ! isset($mapping['columnName'])) {
$mapping['columnName'] = $mapping['fieldName']; $mapping['columnName'] = $mapping['fieldName'];
} }
$lcColumnName = strtolower($mapping['columnName']); $lcColumnName = strtolower($mapping['columnName']);
$this->_columnNames[$mapping['fieldName']] = $mapping['columnName']; $this->columnNames[$mapping['fieldName']] = $mapping['columnName'];
$this->_fieldNames[$mapping['columnName']] = $mapping['fieldName']; $this->fieldNames[$mapping['columnName']] = $mapping['fieldName'];
$this->_lcColumnToFieldNames[$lcColumnName] = $mapping['fieldName']; $this->lcColumnToFieldNames[$lcColumnName] = $mapping['fieldName'];
// Complete id mapping // Complete id mapping
if (isset($mapping['id']) && $mapping['id'] === true) { if (isset($mapping['id']) && $mapping['id'] === true) {
if ( ! in_array($mapping['fieldName'], $this->_identifier)) { if ( ! in_array($mapping['fieldName'], $this->identifier)) {
$this->_identifier[] = $mapping['fieldName']; $this->identifier[] = $mapping['fieldName'];
} }
// Check for composite key // Check for composite key
if ( ! $this->_isIdentifierComposite && count($this->_identifier) > 1) { if ( ! $this->isIdentifierComposite && count($this->identifier) > 1) {
$this->_isIdentifierComposite = true; $this->isIdentifierComposite = true;
} }
} }
// Store ReflectionProperty of mapped field // Store ReflectionProperty of mapped field
$refProp = $this->_reflectionClass->getProperty($mapping['fieldName']); $refProp = $this->reflClass->getProperty($mapping['fieldName']);
$refProp->setAccessible(true); $refProp->setAccessible(true);
$this->_reflectionProperties[$mapping['fieldName']] = $refProp; $this->reflFields[$mapping['fieldName']] = $refProp;
} }
/** /**
...@@ -814,7 +817,7 @@ final class ClassMetadata ...@@ -814,7 +817,7 @@ final class ClassMetadata
*/ */
public function getIdentifier() public function getIdentifier()
{ {
return $this->_identifier; return $this->identifier;
} }
/** /**
...@@ -824,7 +827,7 @@ final class ClassMetadata ...@@ -824,7 +827,7 @@ final class ClassMetadata
*/ */
public function getIdentifierFieldNames() public function getIdentifierFieldNames()
{ {
return $this->_identifier; return $this->identifier;
} }
/** /**
...@@ -835,11 +838,11 @@ final class ClassMetadata ...@@ -835,11 +838,11 @@ final class ClassMetadata
*/ */
public function getSingleIdentifierFieldName() public function getSingleIdentifierFieldName()
{ {
if ($this->_isIdentifierComposite) { if ($this->isIdentifierComposite) {
throw DoctrineException::updateMe("Calling getSingleIdentifierFieldName " throw DoctrineException::updateMe("Calling getSingleIdentifierFieldName "
. "on a class that uses a composite identifier is not allowed."); . "on a class that uses a composite identifier is not allowed.");
} }
return $this->_identifier[0]; return $this->identifier[0];
} }
/** /**
...@@ -862,7 +865,7 @@ final class ClassMetadata ...@@ -862,7 +865,7 @@ final class ClassMetadata
*/ */
public function setIdentifier(array $identifier) public function setIdentifier(array $identifier)
{ {
$this->_identifier = $identifier; $this->identifier = $identifier;
} }
/** /**
...@@ -872,22 +875,8 @@ final class ClassMetadata ...@@ -872,22 +875,8 @@ final class ClassMetadata
*/ */
public function hasField($fieldName) public function hasField($fieldName)
{ {
return isset($this->_reflectionProperties[$fieldName]); return isset($this->reflFields[$fieldName]);
}
/**
* Sets the value of a field on an entity of the mapped class.
*
* @param object $entity
* @param string $field
* @param mixed $value
*/
/*public function setValue($entity, $field, $value)
{
if (isset($this->_reflectionProperties[$field])) {
$this->_reflectionProperties[$field]->setValue($entity, $value);
} }
}*/
/** /**
* Extracts the identifier values of an entity of this class. * Extracts the identifier values of an entity of this class.
...@@ -897,17 +886,17 @@ final class ClassMetadata ...@@ -897,17 +886,17 @@ final class ClassMetadata
*/ */
public function getIdentifierValues($entity) public function getIdentifierValues($entity)
{ {
if ($this->_isIdentifierComposite) { if ($this->isIdentifierComposite) {
$id = array(); $id = array();
foreach ($this->_identifier as $idField) { foreach ($this->identifier as $idField) {
$value = $this->_reflectionProperties[$idField]->getValue($entity); $value = $this->reflFields[$idField]->getValue($entity);
if ($value !== null) { if ($value !== null) {
$id[] = $value; $id[] = $value;
} }
} }
return $id; return $id;
} else { } else {
return $this->_reflectionProperties[$this->_identifier[0]]->getValue($entity); return $this->reflFields[$this->identifier[0]]->getValue($entity);
} }
} }
...@@ -920,12 +909,12 @@ final class ClassMetadata ...@@ -920,12 +909,12 @@ final class ClassMetadata
*/ */
public function setIdentifierValues($entity, $id) public function setIdentifierValues($entity, $id)
{ {
if ($this->_isIdentifierComposite) { if ($this->isIdentifierComposite) {
foreach ((array)$id as $idField => $idValue) { foreach ((array)$id as $idField => $idValue) {
$this->_reflectionProperties[$idField]->setValue($entity, $idValue); $this->reflFields[$idField]->setValue($entity, $idValue);
} }
} else { } else {
$this->_reflectionProperties[$this->_identifier[0]]->setValue($entity, $id); $this->reflFields[$this->identifier[0]]->setValue($entity, $id);
} }
} }
...@@ -938,7 +927,7 @@ final class ClassMetadata ...@@ -938,7 +927,7 @@ final class ClassMetadata
*/ */
public function setFieldValue($entity, $field, $value) public function setFieldValue($entity, $field, $value)
{ {
$this->_reflectionProperties[$field]->setValue($entity, $value); $this->reflFields[$field]->setValue($entity, $value);
} }
/** /**
...@@ -950,7 +939,7 @@ final class ClassMetadata ...@@ -950,7 +939,7 @@ final class ClassMetadata
*/ */
public function setColumnValue($entity, $column, $value) public function setColumnValue($entity, $column, $value)
{ {
$this->_reflectionProperties[$this->_fieldNames[$column]]->setValue($entity, $value); $this->reflFields[$this->fieldNames[$column]]->setValue($entity, $value);
} }
/** /**
...@@ -960,7 +949,7 @@ final class ClassMetadata ...@@ -960,7 +949,7 @@ final class ClassMetadata
*/ */
public function getFieldMappings() public function getFieldMappings()
{ {
return $this->_fieldMappings; return $this->fieldMappings;
} }
/** /**
...@@ -971,7 +960,7 @@ final class ClassMetadata ...@@ -971,7 +960,7 @@ final class ClassMetadata
public function getColumnNames(array $fieldNames = null) public function getColumnNames(array $fieldNames = null)
{ {
if ($fieldNames === null) { if ($fieldNames === null) {
return array_keys($this->_fieldNames); return array_keys($this->fieldNames);
} else { } else {
$columnNames = array(); $columnNames = array();
foreach ($fieldNames as $fieldName) { foreach ($fieldNames as $fieldName) {
...@@ -998,7 +987,7 @@ final class ClassMetadata ...@@ -998,7 +987,7 @@ final class ClassMetadata
*/ */
public function getFieldNames() public function getFieldNames()
{ {
return array_values($this->_fieldNames); return array_values($this->fieldNames);
} }
/** /**
...@@ -1008,7 +997,7 @@ final class ClassMetadata ...@@ -1008,7 +997,7 @@ final class ClassMetadata
*/ */
public function getIdGeneratorType() public function getIdGeneratorType()
{ {
return $this->_generatorType; return $this->generatorType;
} }
/** /**
...@@ -1016,7 +1005,7 @@ final class ClassMetadata ...@@ -1016,7 +1005,7 @@ final class ClassMetadata
*/ */
public function setIdGeneratorType($generatorType) public function setIdGeneratorType($generatorType)
{ {
$this->_generatorType = $generatorType; $this->generatorType = $generatorType;
} }
/** /**
...@@ -1026,7 +1015,7 @@ final class ClassMetadata ...@@ -1026,7 +1015,7 @@ final class ClassMetadata
*/ */
public function usesIdGenerator() public function usesIdGenerator()
{ {
return $this->_generatorType != self::GENERATOR_TYPE_NONE; return $this->generatorType != self::GENERATOR_TYPE_NONE;
} }
/** /**
...@@ -1035,7 +1024,7 @@ final class ClassMetadata ...@@ -1035,7 +1024,7 @@ final class ClassMetadata
*/ */
public function isInheritanceTypeNone() public function isInheritanceTypeNone()
{ {
return $this->_inheritanceType == self::INHERITANCE_TYPE_NONE; return $this->inheritanceType == self::INHERITANCE_TYPE_NONE;
} }
/** /**
...@@ -1046,7 +1035,7 @@ final class ClassMetadata ...@@ -1046,7 +1035,7 @@ final class ClassMetadata
*/ */
public function isInheritanceTypeJoined() public function isInheritanceTypeJoined()
{ {
return $this->_inheritanceType == self::INHERITANCE_TYPE_JOINED; return $this->inheritanceType == self::INHERITANCE_TYPE_JOINED;
} }
/** /**
...@@ -1057,7 +1046,7 @@ final class ClassMetadata ...@@ -1057,7 +1046,7 @@ final class ClassMetadata
*/ */
public function isInheritanceTypeSingleTable() public function isInheritanceTypeSingleTable()
{ {
return $this->_inheritanceType == self::INHERITANCE_TYPE_SINGLE_TABLE; return $this->inheritanceType == self::INHERITANCE_TYPE_SINGLE_TABLE;
} }
/** /**
...@@ -1068,7 +1057,7 @@ final class ClassMetadata ...@@ -1068,7 +1057,7 @@ final class ClassMetadata
*/ */
public function isInheritanceTypeTablePerClass() public function isInheritanceTypeTablePerClass()
{ {
return $this->_inheritanceType == self::INHERITANCE_TYPE_TABLE_PER_CLASS; return $this->inheritanceType == self::INHERITANCE_TYPE_TABLE_PER_CLASS;
} }
/** /**
...@@ -1078,7 +1067,7 @@ final class ClassMetadata ...@@ -1078,7 +1067,7 @@ final class ClassMetadata
*/ */
public function isIdGeneratorIdentity() public function isIdGeneratorIdentity()
{ {
return $this->_generatorType == self::GENERATOR_TYPE_IDENTITY; return $this->generatorType == self::GENERATOR_TYPE_IDENTITY;
} }
/** /**
...@@ -1088,7 +1077,7 @@ final class ClassMetadata ...@@ -1088,7 +1077,7 @@ final class ClassMetadata
*/ */
public function isIdGeneratorSequence() public function isIdGeneratorSequence()
{ {
return $this->_generatorType == self::GENERATOR_TYPE_SEQUENCE; return $this->generatorType == self::GENERATOR_TYPE_SEQUENCE;
} }
/** /**
...@@ -1098,7 +1087,7 @@ final class ClassMetadata ...@@ -1098,7 +1087,7 @@ final class ClassMetadata
*/ */
public function isIdGeneratorTable() public function isIdGeneratorTable()
{ {
$this->_generatorType == self::GENERATOR_TYPE_TABLE; $this->generatorType == self::GENERATOR_TYPE_TABLE;
} }
/** /**
...@@ -1109,7 +1098,7 @@ final class ClassMetadata ...@@ -1109,7 +1098,7 @@ final class ClassMetadata
*/ */
public function isIdentifierNatural() public function isIdentifierNatural()
{ {
return $this->_generatorType == self::GENERATOR_TYPE_NONE; return $this->generatorType == self::GENERATOR_TYPE_NONE;
} }
/** /**
...@@ -1120,8 +1109,8 @@ final class ClassMetadata ...@@ -1120,8 +1109,8 @@ final class ClassMetadata
*/ */
public function getTypeOfField($fieldName) public function getTypeOfField($fieldName)
{ {
return isset($this->_fieldMappings[$fieldName]) ? return isset($this->fieldMappings[$fieldName]) ?
$this->_fieldMappings[$fieldName]['type'] : null; $this->fieldMappings[$fieldName]['type'] : null;
} }
/** /**
...@@ -1139,7 +1128,7 @@ final class ClassMetadata ...@@ -1139,7 +1128,7 @@ final class ClassMetadata
*/ */
public function getFieldLength($fieldName) public function getFieldLength($fieldName)
{ {
return $this->_fieldMappings[$fieldName]['length']; return $this->fieldMappings[$fieldName]['length'];
} }
/** /**
...@@ -1149,7 +1138,7 @@ final class ClassMetadata ...@@ -1149,7 +1138,7 @@ final class ClassMetadata
*/ */
public function getTableName() public function getTableName()
{ {
return $this->_primaryTable['name']; return $this->primaryTable['name'];
} }
public function getInheritedFields() public function getInheritedFields()
...@@ -1176,7 +1165,7 @@ final class ClassMetadata ...@@ -1176,7 +1165,7 @@ final class ClassMetadata
*/ */
public function getInheritanceType() public function getInheritanceType()
{ {
return $this->_inheritanceType; return $this->inheritanceType;
} }
/** /**
...@@ -1189,7 +1178,7 @@ final class ClassMetadata ...@@ -1189,7 +1178,7 @@ final class ClassMetadata
*/ */
public function setSubclasses(array $subclasses) public function setSubclasses(array $subclasses)
{ {
$this->_subClasses = $subclasses; $this->subClasses = $subclasses;
} }
/** /**
...@@ -1199,7 +1188,7 @@ final class ClassMetadata ...@@ -1199,7 +1188,7 @@ final class ClassMetadata
*/ */
public function getSubclasses() public function getSubclasses()
{ {
return $this->_subClasses; return $this->subClasses;
} }
/** /**
...@@ -1209,7 +1198,7 @@ final class ClassMetadata ...@@ -1209,7 +1198,7 @@ final class ClassMetadata
*/ */
public function hasSubclasses() public function hasSubclasses()
{ {
return ! $this->_subClasses; return ! $this->subClasses;
} }
/** /**
...@@ -1219,7 +1208,7 @@ final class ClassMetadata ...@@ -1219,7 +1208,7 @@ final class ClassMetadata
*/ */
public function getParentClasses() public function getParentClasses()
{ {
return $this->_parentClasses; return $this->parentClasses;
} }
/** /**
...@@ -1229,9 +1218,9 @@ final class ClassMetadata ...@@ -1229,9 +1218,9 @@ final class ClassMetadata
*/ */
public function setParentClasses(array $classNames) public function setParentClasses(array $classNames)
{ {
$this->_parentClasses = $classNames; $this->parentClasses = $classNames;
if (count($classNames) > 0) { if (count($classNames) > 0) {
$this->_rootEntityName = array_pop($classNames); $this->rootEntityName = array_pop($classNames);
} }
} }
...@@ -1242,7 +1231,7 @@ final class ClassMetadata ...@@ -1242,7 +1231,7 @@ final class ClassMetadata
*/ */
public function hasParentClasses() public function hasParentClasses()
{ {
return ! $this->_parentClasses; return ! $this->parentClasses;
} }
/** /**
...@@ -1255,7 +1244,7 @@ final class ClassMetadata ...@@ -1255,7 +1244,7 @@ final class ClassMetadata
if ( ! $this->_isInheritanceType($type)) { if ( ! $this->_isInheritanceType($type)) {
throw MappingException::invalidInheritanceType($type); throw MappingException::invalidInheritanceType($type);
} }
$this->_inheritanceType = $type; $this->inheritanceType = $type;
} }
/** /**
...@@ -1265,7 +1254,7 @@ final class ClassMetadata ...@@ -1265,7 +1254,7 @@ final class ClassMetadata
*/ */
public function isInheritedField($fieldName) public function isInheritedField($fieldName)
{ {
return isset($this->_fieldMappings[$fieldName]['inherited']); return isset($this->fieldMappings[$fieldName]['inherited']);
} }
/** /**
...@@ -1276,7 +1265,7 @@ final class ClassMetadata ...@@ -1276,7 +1265,7 @@ final class ClassMetadata
*/ */
public function setTableName($tableName) public function setTableName($tableName)
{ {
$this->_primaryTable['name'] = $tableName; $this->primaryTable['name'] = $tableName;
} }
/** /**
...@@ -1291,7 +1280,7 @@ final class ClassMetadata ...@@ -1291,7 +1280,7 @@ final class ClassMetadata
*/ */
public function setPrimaryTable(array $primaryTableDefinition) public function setPrimaryTable(array $primaryTableDefinition)
{ {
$this->_primaryTable = $primaryTableDefinition; $this->primaryTable = $primaryTableDefinition;
} }
/** /**
...@@ -1302,7 +1291,7 @@ final class ClassMetadata ...@@ -1302,7 +1291,7 @@ final class ClassMetadata
*/ */
public function getPrimaryTable() public function getPrimaryTable()
{ {
return $this->_primaryTable; return $this->primaryTable;
} }
/** /**
...@@ -1343,9 +1332,9 @@ final class ClassMetadata ...@@ -1343,9 +1332,9 @@ final class ClassMetadata
*/ */
private function _completeAssociationMapping(array $mapping) private function _completeAssociationMapping(array $mapping)
{ {
$mapping['sourceEntity'] = $this->_entityName; $mapping['sourceEntity'] = $this->name;
if (isset($mapping['targetEntity']) && strpos($mapping['targetEntity'], '\\') === false) { if (isset($mapping['targetEntity']) && strpos($mapping['targetEntity'], '\\') === false) {
$mapping['targetEntity'] = $this->_namespace . '\\' . $mapping['targetEntity']; $mapping['targetEntity'] = $this->namespace . '\\' . $mapping['targetEntity'];
} }
return $mapping; return $mapping;
} }
...@@ -1358,10 +1347,10 @@ final class ClassMetadata ...@@ -1358,10 +1347,10 @@ final class ClassMetadata
public function mapField(array $mapping) public function mapField(array $mapping)
{ {
$this->_validateAndCompleteFieldMapping($mapping); $this->_validateAndCompleteFieldMapping($mapping);
if (isset($this->_fieldMappings[$mapping['fieldName']])) { if (isset($this->fieldMappings[$mapping['fieldName']])) {
throw MappingException::duplicateFieldMapping($mapping['fieldName']); throw MappingException::duplicateFieldMapping($mapping['fieldName']);
} }
$this->_fieldMappings[$mapping['fieldName']] = $mapping; $this->fieldMappings[$mapping['fieldName']] = $mapping;
} }
/** /**
...@@ -1385,7 +1374,7 @@ final class ClassMetadata ...@@ -1385,7 +1374,7 @@ final class ClassMetadata
*/ */
public function addFieldMapping(array $fieldMapping) public function addFieldMapping(array $fieldMapping)
{ {
$this->_fieldMappings[$fieldMapping['fieldName']] = $fieldMapping; $this->fieldMappings[$fieldMapping['fieldName']] = $fieldMapping;
} }
/** /**
...@@ -1410,7 +1399,7 @@ final class ClassMetadata ...@@ -1410,7 +1399,7 @@ final class ClassMetadata
private function _registerMappingIfInverse(AssociationMapping $assoc) private function _registerMappingIfInverse(AssociationMapping $assoc)
{ {
if ($assoc->isInverseSide()) { if ($assoc->isInverseSide()) {
$this->_inverseMappings[$assoc->getMappedByFieldName()] = $assoc; $this->inverseMappings[$assoc->getMappedByFieldName()] = $assoc;
} }
} }
...@@ -1457,16 +1446,16 @@ final class ClassMetadata ...@@ -1457,16 +1446,16 @@ final class ClassMetadata
private function _storeAssociationMapping(AssociationMapping $assocMapping) private function _storeAssociationMapping(AssociationMapping $assocMapping)
{ {
$sourceFieldName = $assocMapping->getSourceFieldName(); $sourceFieldName = $assocMapping->getSourceFieldName();
if (isset($this->_associationMappings[$sourceFieldName])) { if (isset($this->associationMappings[$sourceFieldName])) {
throw MappingException::duplicateFieldMapping(); throw MappingException::duplicateFieldMapping();
} }
$this->_associationMappings[$sourceFieldName] = $assocMapping; $this->associationMappings[$sourceFieldName] = $assocMapping;
$this->_registerMappingIfInverse($assocMapping); $this->_registerMappingIfInverse($assocMapping);
// Store ReflectionProperty of mapped field // Store ReflectionProperty of mapped field
$refProp = $this->_reflectionClass->getProperty($sourceFieldName); $refProp = $this->reflClass->getProperty($sourceFieldName);
$refProp->setAccessible(true); $refProp->setAccessible(true);
$this->_reflectionProperties[$sourceFieldName] = $refProp; $this->reflFields[$sourceFieldName] = $refProp;
} }
/** /**
...@@ -1476,7 +1465,7 @@ final class ClassMetadata ...@@ -1476,7 +1465,7 @@ final class ClassMetadata
*/ */
public function setCustomRepositoryClass($repositoryClassName) public function setCustomRepositoryClass($repositoryClassName)
{ {
$this->_customRepositoryClassName = $repositoryClassName; $this->customRepositoryClassName = $repositoryClassName;
} }
/** /**
...@@ -1487,7 +1476,7 @@ final class ClassMetadata ...@@ -1487,7 +1476,7 @@ final class ClassMetadata
*/ */
public function getCustomRepositoryClass() public function getCustomRepositoryClass()
{ {
return $this->_customRepositoryClassName; return $this->customRepositoryClassName;
} }
/** /**
...@@ -1502,7 +1491,7 @@ final class ClassMetadata ...@@ -1502,7 +1491,7 @@ final class ClassMetadata
*/ */
public function setJoinSubClasses($bool) public function setJoinSubClasses($bool)
{ {
$this->_joinSubclasses = (bool)$bool; $this->joinSubclasses = (bool)$bool;
} }
/** /**
...@@ -1514,7 +1503,7 @@ final class ClassMetadata ...@@ -1514,7 +1503,7 @@ final class ClassMetadata
*/ */
public function getJoinSubClasses() public function getJoinSubClasses()
{ {
return $this->_joinSubclasses; return $this->joinSubclasses;
} }
/** /**
...@@ -1530,10 +1519,10 @@ final class ClassMetadata ...@@ -1530,10 +1519,10 @@ final class ClassMetadata
$entity->$callback(); $entity->$callback();
} }
foreach ($this->getLifecycleListeners($lifecycleEvent) as $className => $callback) { foreach ($this->getLifecycleListeners($lifecycleEvent) as $className => $callback) {
if ( ! isset($this->_lifecycleListenerInstances[$className])) { if ( ! isset($this->lifecycleListenerInstances[$className])) {
$this->_lifecycleListenerInstances[$className] = new $className; $this->lifecycleListenerInstances[$className] = new $className;
} }
$this->_lifecycleListenerInstances[$className]->$callback($entity); $this->lifecycleListenerInstances[$className]->$callback($entity);
} }
} }
...@@ -1545,8 +1534,8 @@ final class ClassMetadata ...@@ -1545,8 +1534,8 @@ final class ClassMetadata
*/ */
public function getLifecycleCallbacks($event) public function getLifecycleCallbacks($event)
{ {
return isset($this->_lifecycleCallbacks[$event]) ? return isset($this->lifecycleCallbacks[$event]) ?
$this->_lifecycleCallbacks[$event] : array(); $this->lifecycleCallbacks[$event] : array();
} }
/** /**
...@@ -1557,8 +1546,8 @@ final class ClassMetadata ...@@ -1557,8 +1546,8 @@ final class ClassMetadata
*/ */
public function getLifecycleListeners($event) public function getLifecycleListeners($event)
{ {
return isset($this->_lifecycleListeners[$event]) ? return isset($this->lifecycleListeners[$event]) ?
$this->_lifecycleListeners[$event] : array(); $this->lifecycleListeners[$event] : array();
} }
/** /**
...@@ -1572,9 +1561,9 @@ final class ClassMetadata ...@@ -1572,9 +1561,9 @@ final class ClassMetadata
*/ */
public function addLifecycleListener($listenerClass, array $callbacks) public function addLifecycleListener($listenerClass, array $callbacks)
{ {
$this->_lifecycleListeners[$event][$listenerClass] = array(); $this->lifecycleListeners[$event][$listenerClass] = array();
foreach ($callbacks as $method => $event) { foreach ($callbacks as $method => $event) {
$this->_lifecycleListeners[$event][$listenerClass][] = $method; $this->lifecycleListeners[$event][$listenerClass][] = $method;
} }
} }
...@@ -1589,11 +1578,11 @@ final class ClassMetadata ...@@ -1589,11 +1578,11 @@ final class ClassMetadata
*/ */
public function addLifecycleCallback($callback, $event) public function addLifecycleCallback($callback, $event)
{ {
if ( ! isset($this->_lifecycleCallbacks[$event])) { if ( ! isset($this->lifecycleCallbacks[$event])) {
$this->_lifecycleCallbacks[$event] = array(); $this->lifecycleCallbacks[$event] = array();
} }
if ( ! in_array($callback, $this->_lifecycleCallbacks[$event])) { if ( ! in_array($callback, $this->lifecycleCallbacks[$event])) {
$this->_lifecycleCallbacks[$event][$callback] = $callback; $this->lifecycleCallbacks[$event][$callback] = $callback;
} }
} }
...@@ -1605,7 +1594,7 @@ final class ClassMetadata ...@@ -1605,7 +1594,7 @@ final class ClassMetadata
*/ */
public function setDiscriminatorColumn($columnDef) public function setDiscriminatorColumn($columnDef)
{ {
$this->_discriminatorColumn = $columnDef; $this->discriminatorColumn = $columnDef;
} }
/** /**
...@@ -1623,7 +1612,7 @@ final class ClassMetadata ...@@ -1623,7 +1612,7 @@ final class ClassMetadata
*/ */
public function getDiscriminatorColumn() public function getDiscriminatorColumn()
{ {
return $this->_discriminatorColumn; return $this->discriminatorColumn;
} }
/** /**
...@@ -1634,7 +1623,7 @@ final class ClassMetadata ...@@ -1634,7 +1623,7 @@ final class ClassMetadata
*/ */
public function setDiscriminatorValue($value) public function setDiscriminatorValue($value)
{ {
$this->_discriminatorValue = $value; $this->discriminatorValue = $value;
} }
/** /**
...@@ -1645,7 +1634,7 @@ final class ClassMetadata ...@@ -1645,7 +1634,7 @@ final class ClassMetadata
*/ */
public function getDiscriminatorValue() public function getDiscriminatorValue()
{ {
return $this->_discriminatorValue; return $this->discriminatorValue;
} }
/** /**
...@@ -1656,7 +1645,7 @@ final class ClassMetadata ...@@ -1656,7 +1645,7 @@ final class ClassMetadata
*/ */
public function isDiscriminatorColumn($columnName) public function isDiscriminatorColumn($columnName)
{ {
return $columnName === $this->_discriminatorColumn['name']; return $columnName === $this->discriminatorColumn['name'];
} }
/** /**
...@@ -1667,7 +1656,7 @@ final class ClassMetadata ...@@ -1667,7 +1656,7 @@ final class ClassMetadata
*/ */
public function hasAssociation($fieldName) public function hasAssociation($fieldName)
{ {
return isset($this->_associationMappings[$fieldName]); return isset($this->associationMappings[$fieldName]);
} }
/** /**
...@@ -1679,8 +1668,8 @@ final class ClassMetadata ...@@ -1679,8 +1668,8 @@ final class ClassMetadata
*/ */
public function isSingleValuedAssociation($fieldName) public function isSingleValuedAssociation($fieldName)
{ {
return isset($this->_associationMappings[$fieldName]) && return isset($this->associationMappings[$fieldName]) &&
$this->_associationMappings[$fieldName]->isOneToOne(); $this->associationMappings[$fieldName]->isOneToOne();
} }
/** /**
...@@ -1692,8 +1681,8 @@ final class ClassMetadata ...@@ -1692,8 +1681,8 @@ final class ClassMetadata
*/ */
public function isCollectionValuedAssociation($fieldName) public function isCollectionValuedAssociation($fieldName)
{ {
return isset($this->_associationMappings[$fieldName]) && return isset($this->associationMappings[$fieldName]) &&
! $this->_associationMappings[$fieldName]->isOneToOne(); ! $this->associationMappings[$fieldName]->isOneToOne();
} }
/** /**
...@@ -1705,7 +1694,7 @@ final class ClassMetadata ...@@ -1705,7 +1694,7 @@ final class ClassMetadata
*/ */
/*public function getIdGeneratorName() /*public function getIdGeneratorName()
{ {
return $this->_idGeneratorName; return $this->idGeneratorName;
}*/ }*/
/** /**
...@@ -1715,7 +1704,7 @@ final class ClassMetadata ...@@ -1715,7 +1704,7 @@ final class ClassMetadata
*/ */
public function setIdGenerator($generator) public function setIdGenerator($generator)
{ {
$this->_idGenerator = $generator; $this->idGenerator = $generator;
} }
/** /**
...@@ -1725,7 +1714,7 @@ final class ClassMetadata ...@@ -1725,7 +1714,7 @@ final class ClassMetadata
*/ */
public function getIdGenerator() public function getIdGenerator()
{ {
return $this->_idGenerator; return $this->idGenerator;
} }
/** /**
...@@ -1745,7 +1734,7 @@ final class ClassMetadata ...@@ -1745,7 +1734,7 @@ final class ClassMetadata
*/ */
public function getSequenceGeneratorDefinition() public function getSequenceGeneratorDefinition()
{ {
return $this->_sequenceGeneratorDefinition; return $this->sequenceGeneratorDefinition;
} }
/** /**
...@@ -1764,7 +1753,7 @@ final class ClassMetadata ...@@ -1764,7 +1753,7 @@ final class ClassMetadata
*/ */
public function setSequenceGeneratorDefinition(array $definition) public function setSequenceGeneratorDefinition(array $definition)
{ {
$this->_sequenceGeneratorDefinition = $definition; $this->sequenceGeneratorDefinition = $definition;
} }
/** /**
......
...@@ -135,20 +135,20 @@ class ClassMetadataFactory ...@@ -135,20 +135,20 @@ class ClassMetadataFactory
foreach ($parentClasses as $className) { foreach ($parentClasses as $className) {
$class = $this->_newClassMetadataInstance($className); $class = $this->_newClassMetadataInstance($className);
if ($parent) { if ($parent) {
$class->setInheritanceType($parent->getInheritanceType()); $class->setInheritanceType($parent->inheritanceType);
//$class->setDiscriminatorMap($parent->getDiscriminatorMap()); //$class->setDiscriminatorMap($parent->getDiscriminatorMap());
$class->setDiscriminatorColumn($parent->getDiscriminatorColumn()); $class->setDiscriminatorColumn($parent->discriminatorColumn);
$class->setIdGeneratorType($parent->getIdGeneratorType()); $class->setIdGeneratorType($parent->generatorType);
$this->_addInheritedFields($class, $parent); $this->_addInheritedFields($class, $parent);
$this->_addInheritedRelations($class, $parent); $this->_addInheritedRelations($class, $parent);
$class->setIdentifier($parent->getIdentifier()); $class->setIdentifier($parent->identifier);
} }
// Invoke driver // Invoke driver
$this->_driver->loadMetadataForClass($className, $class); $this->_driver->loadMetadataForClass($className, $class);
// Verify & complete identifier mapping // Verify & complete identifier mapping
if ( ! $class->getIdentifier()) { if ( ! $class->identifier) {
throw MappingException::identifierRequired($className); throw MappingException::identifierRequired($className);
} }
if ($parent) { if ($parent) {
...@@ -157,7 +157,7 @@ class ClassMetadataFactory ...@@ -157,7 +157,7 @@ class ClassMetadataFactory
} else if ($parent->isIdGeneratorTable()) { } else if ($parent->isIdGeneratorTable()) {
$class->getTableGeneratorDefinition($parent->getTableGeneratorDefinition()); $class->getTableGeneratorDefinition($parent->getTableGeneratorDefinition());
} }
$class->setIdGeneratorType($parent->getIdGeneratorType()); $class->setIdGeneratorType($parent->generatorType);
$class->setidGenerator($parent->getIdGenerator()); $class->setidGenerator($parent->getIdGenerator());
} else { } else {
$this->_completeIdGeneratorMapping($class); $this->_completeIdGeneratorMapping($class);
...@@ -193,9 +193,9 @@ class ClassMetadataFactory ...@@ -193,9 +193,9 @@ class ClassMetadataFactory
*/ */
private function _addInheritedFields(ClassMetadata $subClass, ClassMetadata $parentClass) private function _addInheritedFields(ClassMetadata $subClass, ClassMetadata $parentClass)
{ {
foreach ($parentClass->getFieldMappings() as $fieldName => $mapping) { foreach ($parentClass->fieldMappings as $fieldName => $mapping) {
if ( ! isset($mapping['inherited'])) { if ( ! isset($mapping['inherited'])) {
$mapping['inherited'] = $parentClass->getClassName(); $mapping['inherited'] = $parentClass->name;
} }
$subClass->addFieldMapping($mapping); $subClass->addFieldMapping($mapping);
$subClass->addReflectionProperty($fieldName, $parentClass->getReflectionProperty($fieldName)); $subClass->addReflectionProperty($fieldName, $parentClass->getReflectionProperty($fieldName));
...@@ -210,7 +210,7 @@ class ClassMetadataFactory ...@@ -210,7 +210,7 @@ class ClassMetadataFactory
*/ */
private function _addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass) private function _addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass)
{ {
foreach ($parentClass->getAssociationMappings() as $mapping) { foreach ($parentClass->associationMappings as $mapping) {
$subClass->addAssociationMapping($mapping); $subClass->addAssociationMapping($mapping);
} }
} }
...@@ -223,7 +223,7 @@ class ClassMetadataFactory ...@@ -223,7 +223,7 @@ class ClassMetadataFactory
*/ */
private function _completeIdGeneratorMapping(ClassMetadata $class) private function _completeIdGeneratorMapping(ClassMetadata $class)
{ {
$idGenType = $class->getIdGeneratorType(); $idGenType = $class->generatorType;
if ($idGenType == ClassMetadata::GENERATOR_TYPE_AUTO) { if ($idGenType == ClassMetadata::GENERATOR_TYPE_AUTO) {
if ($this->_targetPlatform->prefersSequences()) { if ($this->_targetPlatform->prefersSequences()) {
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_SEQUENCE); $class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_SEQUENCE);
...@@ -235,7 +235,7 @@ class ClassMetadataFactory ...@@ -235,7 +235,7 @@ class ClassMetadataFactory
} }
// Create & assign an appropriate ID generator instance // Create & assign an appropriate ID generator instance
switch ($class->getIdGeneratorType()) { switch ($class->generatorType) {
case ClassMetadata::GENERATOR_TYPE_IDENTITY: case ClassMetadata::GENERATOR_TYPE_IDENTITY:
$class->setIdGenerator(new \Doctrine\ORM\Id\IdentityGenerator()); $class->setIdGenerator(new \Doctrine\ORM\Id\IdentityGenerator());
break; break;
......
...@@ -159,7 +159,7 @@ class OneToOneMapping extends AssociationMapping ...@@ -159,7 +159,7 @@ class OneToOneMapping extends AssociationMapping
if ($targetClass->hasInverseAssociation($this->_sourceFieldName)) { if ($targetClass->hasInverseAssociation($this->_sourceFieldName)) {
$targetClass->setFieldValue( $targetClass->setFieldValue(
$targetEntity, $targetEntity,
$targetClass->getInverseAssociationMapping($this->_sourceFieldName)->getSourceFieldName(), $targetClass->inverseMappings[$this->_sourceFieldName]->getSourceFieldName(),
$owningEntity); $owningEntity);
} }
} else { } else {
......
...@@ -123,7 +123,7 @@ final class PersistentCollection extends \Doctrine\Common\Collections\Collection ...@@ -123,7 +123,7 @@ final class PersistentCollection extends \Doctrine\Common\Collections\Collection
public function __construct(EntityManager $em, $class, array $data = array()) public function __construct(EntityManager $em, $class, array $data = array())
{ {
parent::__construct($data); parent::__construct($data);
$this->_type = $class->getClassName(); $this->_type = $class->name;
$this->_em = $em; $this->_em = $em;
$this->_ownerClass = $class; $this->_ownerClass = $class;
} }
...@@ -168,8 +168,8 @@ final class PersistentCollection extends \Doctrine\Common\Collections\Collection ...@@ -168,8 +168,8 @@ final class PersistentCollection extends \Doctrine\Common\Collections\Collection
$targetClass = $this->_em->getClassMetadata($assoc->getTargetEntityName()); $targetClass = $this->_em->getClassMetadata($assoc->getTargetEntityName());
if ($targetClass->hasInverseAssociationMapping($assoc->getSourceFieldName())) { if ($targetClass->hasInverseAssociationMapping($assoc->getSourceFieldName())) {
// bi-directional // bi-directional
$this->_backRefFieldName = $targetClass->getInverseAssociationMapping( $this->_backRefFieldName = $targetClass->inverseMappings[
$assoc->getSourceFieldName())->getSourceFieldName(); $assoc->getSourceFieldName()]->getSourceFieldName();
} }
} }
} }
......
...@@ -80,7 +80,7 @@ abstract class AbstractEntityPersister ...@@ -80,7 +80,7 @@ abstract class AbstractEntityPersister
public function __construct(EntityManager $em, ClassMetadata $class) public function __construct(EntityManager $em, ClassMetadata $class)
{ {
$this->_em = $em; $this->_em = $em;
$this->_entityName = $class->getClassName(); $this->_entityName = $class->name;
$this->_conn = $em->getConnection(); $this->_conn = $em->getConnection();
$this->_class = $class; $this->_class = $class;
} }
...@@ -262,7 +262,7 @@ abstract class AbstractEntityPersister ...@@ -262,7 +262,7 @@ abstract class AbstractEntityPersister
$stmt->execute(array_values($criteria)); $stmt->execute(array_values($criteria));
$data = array(); $data = array();
foreach ($stmt->fetch(\PDO::FETCH_ASSOC) as $column => $value) { foreach ($stmt->fetch(\PDO::FETCH_ASSOC) as $column => $value) {
$fieldName = $this->_class->getFieldNameForLowerColumnName($column); $fieldName = $this->_class->lcColumnToFieldNames[$column];
$data[$fieldName] = Type::getType($this->_class->getTypeOfField($fieldName)) $data[$fieldName] = Type::getType($this->_class->getTypeOfField($fieldName))
->convertToPHPValue($value); ->convertToPHPValue($value);
} }
...@@ -276,7 +276,7 @@ abstract class AbstractEntityPersister ...@@ -276,7 +276,7 @@ abstract class AbstractEntityPersister
} }
$id = array(); $id = array();
if ($this->_class->isIdentifierComposite()) { if ($this->_class->isIdentifierComposite()) {
$identifierFieldNames = $this->_class->getIdentifier(); $identifierFieldNames = $this->_class->identifier;
foreach ($identifierFieldNames as $fieldName) { foreach ($identifierFieldNames as $fieldName) {
$id[] = $data[$fieldName]; $id[] = $data[$fieldName];
} }
...@@ -287,7 +287,7 @@ abstract class AbstractEntityPersister ...@@ -287,7 +287,7 @@ abstract class AbstractEntityPersister
} }
if ( ! $this->_em->getConfiguration()->getAllowPartialObjects()) { if ( ! $this->_em->getConfiguration()->getAllowPartialObjects()) {
foreach ($this->_class->getAssociationMappings() as $field => $assoc) { foreach ($this->_class->associationMappings as $field => $assoc) {
if ($assoc->isOneToOne()) { if ($assoc->isOneToOne()) {
if ($assoc->isLazilyFetched()) { if ($assoc->isLazilyFetched()) {
// Inject proxy // Inject proxy
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
namespace Doctrine\ORM\Persisters; namespace Doctrine\ORM\Persisters;
use Doctrine\Common\DoctrineException;
/** /**
* The joined subclass persister maps a single entity instance to several tables in the * The joined subclass persister maps a single entity instance to several tables in the
* database as it is defined by <tt>Class Table Inheritance</tt>. * database as it is defined by <tt>Class Table Inheritance</tt>.
...@@ -41,7 +43,7 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -41,7 +43,7 @@ class JoinedSubclassPersister extends AbstractEntityPersister
* @return boolean * @return boolean
* @override * @override
*/ */
public function insert($entity) /*public function insert($entity)
{ {
$class = $entity->getClass(); $class = $entity->getClass();
...@@ -51,8 +53,8 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -51,8 +53,8 @@ class JoinedSubclassPersister extends AbstractEntityPersister
$dataSet = $this->_groupFieldsByDefiningClass($class, $dataSet); $dataSet = $this->_groupFieldsByDefiningClass($class, $dataSet);
$component = $class->getClassName(); $component = $class->name;
$classes = $class->getParentClasses(); $classes = $class->parentClasses;
array_unshift($classes, $component); array_unshift($classes, $component);
$identifier = null; $identifier = null;
...@@ -66,12 +68,12 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -66,12 +68,12 @@ class JoinedSubclassPersister extends AbstractEntityPersister
$seq = $entity->getClassMetadata()->getTableOption('sequenceName'); $seq = $entity->getClassMetadata()->getTableOption('sequenceName');
if ( ! empty($seq)) { if ( ! empty($seq)) {
$id = $this->_conn->getSequenceManager()->nextId($seq); $id = $this->_conn->getSequenceManager()->nextId($seq);
$identifierFields = $parentClass->getIdentifier(); $identifierFields = $parentClass->identifier;
$dataSet[$parent][$identifierFields[0]] = $id; $dataSet[$parent][$identifierFields[0]] = $id;
$this->_insertRow($parentClass->getTableName(), $dataSet[$parent]); $this->_insertRow($parentClass->getTableName(), $dataSet[$parent]);
} }
} else { } else {
throw \Doctrine\Common\DoctrineException::updateMe("Unsupported identifier type '$identifierType'."); throw DoctrineException::updateMe("Unsupported identifier type '$identifierType'.");
} }
$entity->_assignIdentifier($identifier); $entity->_assignIdentifier($identifier);
} else { } else {
...@@ -83,7 +85,7 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -83,7 +85,7 @@ class JoinedSubclassPersister extends AbstractEntityPersister
} }
return true; return true;
} }*/
/** /**
* Updates an entity that is part of a Class Table Inheritance hierarchy. * Updates an entity that is part of a Class Table Inheritance hierarchy.
...@@ -91,14 +93,14 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -91,14 +93,14 @@ class JoinedSubclassPersister extends AbstractEntityPersister
* @param Doctrine_Entity $record record to be updated * @param Doctrine_Entity $record record to be updated
* @return boolean whether or not the update was successful * @return boolean whether or not the update was successful
*/ */
protected function _doUpdate($entity) /*protected function _doUpdate($entity)
{ {
$conn = $this->_conn; $conn = $this->_conn;
$classMetadata = $this->_classMetadata; $classMetadata = $this->_classMetadata;
$identifier = $this->_convertFieldToColumnNames($record->identifier(), $classMetadata); $identifier = $this->_convertFieldToColumnNames($record->identifier(), $classMetadata);
$dataSet = $this->_groupFieldsByDefiningClass($record); $dataSet = $this->_groupFieldsByDefiningClass($record);
$component = $classMetadata->getClassName(); $component = $classMetadata->name;
$classes = $classMetadata->getParentClasses(); $classes = $classMetadata->parentClasses;
array_unshift($classes, $component); array_unshift($classes, $component);
foreach ($record as $field => $value) { foreach ($record as $field => $value) {
...@@ -119,13 +121,13 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -119,13 +121,13 @@ class JoinedSubclassPersister extends AbstractEntityPersister
$record->assignIdentifier(true); $record->assignIdentifier(true);
return true; return true;
} }*/
/** /**
* Deletes an entity that is part of a Class Table Inheritance hierarchy. * Deletes an entity that is part of a Class Table Inheritance hierarchy.
* *
*/ */
protected function _doDelete(Doctrine_ORM_Entity $record) /*protected function _doDelete(Doctrine_ORM_Entity $record)
{ {
$conn = $this->_conn; $conn = $this->_conn;
try { try {
...@@ -139,7 +141,7 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -139,7 +141,7 @@ class JoinedSubclassPersister extends AbstractEntityPersister
// run deletions, starting from the class, upwards the hierarchy // run deletions, starting from the class, upwards the hierarchy
$conn->delete($class->getTableName(), $identifier); $conn->delete($class->getTableName(), $identifier);
foreach ($class->getParentClasses() as $parent) { foreach ($class->parentClasses as $parent) {
$parentClass = $conn->getClassMetadata($parent); $parentClass = $conn->getClassMetadata($parent);
$this->_deleteRow($parentClass->getTableName(), $identifier); $this->_deleteRow($parentClass->getTableName(), $identifier);
} }
...@@ -154,7 +156,7 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -154,7 +156,7 @@ class JoinedSubclassPersister extends AbstractEntityPersister
} }
return true; return true;
} }*/
/** /**
* Adds all parent classes as INNER JOINs and subclasses as OUTER JOINs * Adds all parent classes as INNER JOINs and subclasses as OUTER JOINs
...@@ -164,21 +166,21 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -164,21 +166,21 @@ class JoinedSubclassPersister extends AbstractEntityPersister
* *
* @return array The custom joins in the format <className> => <joinType> * @return array The custom joins in the format <className> => <joinType>
*/ */
public function getCustomJoins() /*public function getCustomJoins()
{ {
$customJoins = array(); $customJoins = array();
$classMetadata = $this->_classMetadata; $classMetadata = $this->_classMetadata;
foreach ($classMetadata->getParentClasses() as $parentClass) { foreach ($classMetadata->parentClasses as $parentClass) {
$customJoins[$parentClass] = 'INNER'; $customJoins[$parentClass] = 'INNER';
} }
foreach ($classMetadata->getSubclasses() as $subClass) { foreach ($classMetadata->subClasses as $subClass) {
if ($subClass != $this->getComponentName()) { if ($subClass != $this->getComponentName()) {
$customJoins[$subClass] = 'LEFT'; $customJoins[$subClass] = 'LEFT';
} }
} }
return $customJoins; return $customJoins;
} }*/
/** /**
* Adds the discriminator column to the selected fields in a query as well as * Adds the discriminator column to the selected fields in a query as well as
...@@ -189,34 +191,34 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -189,34 +191,34 @@ class JoinedSubclassPersister extends AbstractEntityPersister
* *
* @return array An array with the field names that will get added to the query. * @return array An array with the field names that will get added to the query.
*/ */
public function getCustomFields() /*public function getCustomFields()
{ {
$classMetadata = $this->_classMetadata; $classMetadata = $this->_classMetadata;
$conn = $this->_conn; $conn = $this->_conn;
$discrColumn = $classMetadata->getDiscriminatorColumn(); $discrColumn = $classMetadata->discriminatorColumn;
$fields = array($discrColumn['name']); $fields = array($discrColumn['name']);
if ($classMetadata->getSubclasses()) { if ($classMetadata->subClasses) {
foreach ($classMetadata->getSubclasses() as $subClass) { foreach ($classMetadata->subClasses as $subClass) {
$fields = array_merge($conn->getClassMetadata($subClass)->getFieldNames(), $fields); $fields = array_merge($conn->getClassMetadata($subClass)->fieldNames, $fields);
} }
} }
return array_unique($fields); return array_unique($fields);
} }*/
/** /**
* *
*/ */
public function getFieldNames() /*public function getFieldNames()
{ {
if ($this->_fieldNames) { if ($this->_fieldNames) {
return $this->_fieldNames; return $this->_fieldNames;
} }
$fieldNames = $this->_classMetadata->getFieldNames(); $fieldNames = $this->_classMetadata->fieldNames;
$this->_fieldNames = array_unique($fieldNames); $this->_fieldNames = array_unique($fieldNames);
return $fieldNames; return $fieldNames;
} }*/
/** /**
* *
...@@ -230,14 +232,14 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -230,14 +232,14 @@ class JoinedSubclassPersister extends AbstractEntityPersister
return $classMetadata; return $classMetadata;
} }
foreach ($classMetadata->getParentClasses() as $parentClass) { foreach ($classMetadata->parentClasses as $parentClass) {
$parentTable = $conn->getClassMetadata($parentClass); $parentTable = $conn->getClassMetadata($parentClass);
if ($parentTable->hasField($fieldName) && ! $parentTable->isInheritedField($fieldName)) { if ($parentTable->hasField($fieldName) && ! $parentTable->isInheritedField($fieldName)) {
return $parentTable; return $parentTable;
} }
} }
foreach ((array)$classMetadata->getSubclasses() as $subClass) { foreach ((array)$classMetadata->subClasses as $subClass) {
$subTable = $conn->getClassMetadata($subClass); $subTable = $conn->getClassMetadata($subClass);
if ($subTable->hasField($fieldName) && ! $subTable->isInheritedField($fieldName)) { if ($subTable->hasField($fieldName) && ! $subTable->isInheritedField($fieldName)) {
return $subTable; return $subTable;
...@@ -253,17 +255,17 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -253,17 +255,17 @@ class JoinedSubclassPersister extends AbstractEntityPersister
* *
* @return array * @return array
*/ */
protected function _groupFieldsByDefiningClass(Doctrine_ClassMetadata $class, array $fields) /*protected function _groupFieldsByDefiningClass(Doctrine_ClassMetadata $class, array $fields)
{ {
$dataSet = array(); $dataSet = array();
$component = $class->getClassName(); $component = $class->name;
$classes = array_merge(array($component), $class->getParentClasses()); $classes = array_merge(array($component), $class->parentClasses);
foreach ($classes as $class) { foreach ($classes as $class) {
$dataSet[$class] = array(); $dataSet[$class] = array();
$parentClassMetadata = $this->_em->getClassMetadata($class); $parentClassMetadata = $this->_em->getClassMetadata($class);
foreach ($parentClassMetadata->getFieldMappings() as $fieldName => $mapping) { foreach ($parentClassMetadata->fieldMappings as $fieldName => $mapping) {
if ((isset($mapping['id']) && $mapping['id'] === true) || if ((isset($mapping['id']) && $mapping['id'] === true) ||
(isset($mapping['inherited']) && $mapping['inherited'] === true)) { (isset($mapping['inherited']) && $mapping['inherited'] === true)) {
continue; continue;
...@@ -277,5 +279,5 @@ class JoinedSubclassPersister extends AbstractEntityPersister ...@@ -277,5 +279,5 @@ class JoinedSubclassPersister extends AbstractEntityPersister
} }
return $dataSet; return $dataSet;
} }*/
} }
\ No newline at end of file
...@@ -39,8 +39,8 @@ class SingleTablePersister extends AbstractEntityPersister ...@@ -39,8 +39,8 @@ class SingleTablePersister extends AbstractEntityPersister
parent::_prepareData($entity, $result, $isInsert); parent::_prepareData($entity, $result, $isInsert);
// Populate the discriminator column // Populate the discriminator column
if ($isInsert) { if ($isInsert) {
$discColumn = $this->_class->getDiscriminatorColumn(); $discColumn = $this->_class->discriminatorColumn;
$result[$discColumn['name']] = $this->_class->getDiscriminatorValue(); $result[$discColumn['name']] = $this->_class->discriminatorValue;
} }
} }
} }
\ No newline at end of file
...@@ -36,23 +36,23 @@ class StandardEntityPersister extends AbstractEntityPersister ...@@ -36,23 +36,23 @@ class StandardEntityPersister extends AbstractEntityPersister
/** /**
* Deletes an entity. * Deletes an entity.
*/ */
protected function _doDelete($record) /*protected function _doDelete($record)
{ {
} }*/
/** /**
* Inserts a single entity into the database. * Inserts a single entity into the database.
* *
* @param Doctrine\ORM\Entity $entity The entity to insert. * @param Doctrine\ORM\Entity $entity The entity to insert.
*/ */
protected function _doInsert(Doctrine_ORM_Entity $record) /*protected function _doInsert(Doctrine_ORM_Entity $record)
{ {
} }*/
/** /**
* Updates an entity. * Updates an entity.
*/ */
protected function _doUpdate(Doctrine_ORM_Entity $record) /*protected function _doUpdate(Doctrine_ORM_Entity $record)
{ {
} }*/
} }
\ No newline at end of file
...@@ -39,7 +39,7 @@ class RangeVariableDeclaration extends Node ...@@ -39,7 +39,7 @@ class RangeVariableDeclaration extends Node
public function __construct($classMetadata, $aliasIdentificationVar) public function __construct($classMetadata, $aliasIdentificationVar)
{ {
$this->_classMetadata = $classMetadata; $this->_classMetadata = $classMetadata;
$this->_abstractSchemaName = $classMetadata->getClassName(); $this->_abstractSchemaName = $classMetadata->name;
$this->_aliasIdentificationVariable = $aliasIdentificationVar; $this->_aliasIdentificationVariable = $aliasIdentificationVar;
} }
......
...@@ -388,7 +388,7 @@ class Parser ...@@ -388,7 +388,7 @@ class Parser
if (count($parts) == 2) { if (count($parts) == 2) {
$expr->setIsSimpleStateFieldPathExpression(true); $expr->setIsSimpleStateFieldPathExpression(true);
if ( ! $qComps[$dqlAlias]['metadata']->hasField($parts[1])) { if ( ! $qComps[$dqlAlias]['metadata']->hasField($parts[1])) {
$this->semanticalError('The class ' . $qComps[$dqlAlias]['metadata']->getClassName() $this->semanticalError('The class ' . $qComps[$dqlAlias]['metadata']->name
. ' has no simple state field named ' . $parts[1]); . ' has no simple state field named ' . $parts[1]);
} }
} else { } else {
...@@ -422,7 +422,7 @@ class Parser ...@@ -422,7 +422,7 @@ class Parser
} }
// Last part MUST be a simple state field // Last part MUST be a simple state field
if ( ! $qComps[$dqlAlias]['metadata']->hasField($parts[$numParts-1])) { if ( ! $qComps[$dqlAlias]['metadata']->hasField($parts[$numParts-1])) {
$this->semanticalError('The class ' . $qComps[$dqlAlias]['metadata']->getClassName() $this->semanticalError('The class ' . $qComps[$dqlAlias]['metadata']->name
. ' has no simple state field named ' . $parts[$numParts-1]); . ' has no simple state field named ' . $parts[$numParts-1]);
} }
} }
...@@ -791,7 +791,7 @@ class Parser ...@@ -791,7 +791,7 @@ class Parser
$parentClass = $this->_queryComponents[$joinPathExpression->getIdentificationVariable()]['metadata']; $parentClass = $this->_queryComponents[$joinPathExpression->getIdentificationVariable()]['metadata'];
$assocField = $joinPathExpression->getAssociationField(); $assocField = $joinPathExpression->getAssociationField();
if ( ! $parentClass->hasAssociation($assocField)) { if ( ! $parentClass->hasAssociation($assocField)) {
$this->semanticalError("Class " . $parentClass->getClassName() . $this->semanticalError("Class " . $parentClass->name .
" has no association named '$assocField'."); " has no association named '$assocField'.");
} }
$targetClassName = $parentClass->getAssociationMapping($assocField)->getTargetEntityName(); $targetClassName = $parentClass->getAssociationMapping($assocField)->getTargetEntityName();
...@@ -911,7 +911,7 @@ class Parser ...@@ -911,7 +911,7 @@ class Parser
$class = $this->_em->getClassMetadata($assoc->getTargetEntityName()); $class = $this->_em->getClassMetadata($assoc->getTargetEntityName());
$assocSeen = true; $assocSeen = true;
} else { } else {
$this->semanticalError('The class ' . $class->getClassName() . $this->semanticalError('The class ' . $class->name .
' has no field or association named ' . $part); ' has no field or association named ' . $part);
} }
$parts[] = $part; $parts[] = $part;
......
...@@ -131,10 +131,10 @@ class SqlWalker ...@@ -131,10 +131,10 @@ class SqlWalker
//if ($this->_query->getHydrationMode() == \Doctrine\ORM\Query::HYDRATE_OBJECT) { //if ($this->_query->getHydrationMode() == \Doctrine\ORM\Query::HYDRATE_OBJECT) {
if ($class->isInheritanceTypeSingleTable() || $class->isInheritanceTypeJoined()) { if ($class->isInheritanceTypeSingleTable() || $class->isInheritanceTypeJoined()) {
$tblAlias = $this->getSqlTableAlias($class->getTableName()); $tblAlias = $this->getSqlTableAlias($class->getTableName());
$discrColumn = $class->getDiscriminatorColumn(); $discrColumn = $class->discriminatorColumn;
$columnAlias = $this->getSqlColumnAlias($discrColumn['name']); $columnAlias = $this->getSqlColumnAlias($discrColumn['name']);
$sql .= ", $tblAlias." . $discrColumn['name'] . ' AS ' . $columnAlias; $sql .= ", $tblAlias." . $discrColumn['name'] . ' AS ' . $columnAlias;
$this->_resultSetMapping->setDiscriminatorColumn($class->getClassName(), $dqlAlias, $columnAlias); $this->_resultSetMapping->setDiscriminatorColumn($class->name, $dqlAlias, $columnAlias);
} }
//} //}
} }
...@@ -392,11 +392,11 @@ class SqlWalker ...@@ -392,11 +392,11 @@ class SqlWalker
$sqlTableAlias = $this->getSqlTableAlias($class->getTableName()); $sqlTableAlias = $this->getSqlTableAlias($class->getTableName());
// Gather all fields // Gather all fields
$fieldMappings = $class->getFieldMappings(); $fieldMappings = $class->fieldMappings;
foreach ($class->getSubclasses() as $subclassName) { foreach ($class->subClasses as $subclassName) {
$fieldMappings = array_merge( $fieldMappings = array_merge(
$fieldMappings, $fieldMappings,
$this->_em->getClassMetadata($subclassName)->getFieldMappings() $this->_em->getClassMetadata($subclassName)->fieldMappings
); );
} }
...@@ -713,11 +713,11 @@ class SqlWalker ...@@ -713,11 +713,11 @@ class SqlWalker
$class = $this->_queryComponents[$dqlAlias]['metadata']; $class = $this->_queryComponents[$dqlAlias]['metadata'];
if ($class->isInheritanceTypeSingleTable()) { if ($class->isInheritanceTypeSingleTable()) {
$conn = $this->_em->getConnection(); $conn = $this->_em->getConnection();
$values = array($conn->quote($class->getDiscriminatorValue())); $values = array($conn->quote($class->discriminatorValue));
foreach ($class->getSubclasses() as $subclassName) { foreach ($class->subClasses as $subclassName) {
$values[] = $conn->quote($this->_em->getClassMetadata($subclassName)->getDiscriminatorValue()); $values[] = $conn->quote($this->_em->getClassMetadata($subclassName)->discriminatorValue);
} }
$discrColumn = $class->getDiscriminatorColumn(); $discrColumn = $class->discriminatorColumn;
if ($this->_useSqlTableAliases) { if ($this->_useSqlTableAliases) {
$sql .= $this->getSqlTableAlias($class->getTableName()) . '.'; $sql .= $this->getSqlTableAlias($class->getTableName()) . '.';
} }
......
...@@ -84,7 +84,7 @@ class SchemaTool ...@@ -84,7 +84,7 @@ class SchemaTool
// First we create the tables // First we create the tables
foreach ($classes as $class) { foreach ($classes as $class) {
if (isset($processedClasses[$class->getClassName()])) { if (isset($processedClasses[$class->name])) {
continue; continue;
} }
...@@ -99,11 +99,11 @@ class SchemaTool ...@@ -99,11 +99,11 @@ class SchemaTool
$columns[$discrColumnDef['name']] = $discrColumnDef; $columns[$discrColumnDef['name']] = $discrColumnDef;
// Aggregate all the information from all classes in the hierarchy // Aggregate all the information from all classes in the hierarchy
foreach ($class->getParentClasses() as $parentClassName) { foreach ($class->parentClasses as $parentClassName) {
// Parent class information is already contained in this class // Parent class information is already contained in this class
$processedClasses[$parentClassName] = true; $processedClasses[$parentClassName] = true;
} }
foreach ($class->getSubclasses() as $subClassName) { foreach ($class->subClasses as $subClassName) {
$subClass = $this->_em->getClassMetadata($subClassName); $subClass = $this->_em->getClassMetadata($subClassName);
$columns = array_merge($columns, $this->_gatherColumns($subClass, $options)); $columns = array_merge($columns, $this->_gatherColumns($subClass, $options));
$this->_gatherRelationsSql($subClass, $sql, $columns, $foreignKeyConstraints); $this->_gatherRelationsSql($subClass, $sql, $columns, $foreignKeyConstraints);
...@@ -116,7 +116,7 @@ class SchemaTool ...@@ -116,7 +116,7 @@ class SchemaTool
} }
$sql = array_merge($sql, $this->_platform->getCreateTableSql($class->getTableName(), $columns, $options)); $sql = array_merge($sql, $this->_platform->getCreateTableSql($class->getTableName(), $columns, $options));
$processedClasses[$class->getClassName()] = true; $processedClasses[$class->name] = true;
if ($class->isIdGeneratorSequence()) { if ($class->isIdGeneratorSequence()) {
$seqDef = $class->getSequenceGeneratorDefinition(); $seqDef = $class->getSequenceGeneratorDefinition();
...@@ -143,7 +143,7 @@ class SchemaTool ...@@ -143,7 +143,7 @@ class SchemaTool
private function _getDiscriminatorColumnDefinition($class) private function _getDiscriminatorColumnDefinition($class)
{ {
$discrColumn = $class->getDiscriminatorColumn(); $discrColumn = $class->discriminatorColumn;
return array( return array(
'name' => $discrColumn['name'], 'name' => $discrColumn['name'],
'type' => Type::getType($discrColumn['type']), 'type' => Type::getType($discrColumn['type']),
...@@ -155,7 +155,7 @@ class SchemaTool ...@@ -155,7 +155,7 @@ class SchemaTool
private function _gatherColumns($class, array &$options) private function _gatherColumns($class, array &$options)
{ {
$columns = array(); $columns = array();
foreach ($class->getFieldMappings() as $fieldName => $mapping) { foreach ($class->fieldMappings as $fieldName => $mapping) {
$column = array(); $column = array();
$column['name'] = $mapping['columnName']; $column['name'] = $mapping['columnName'];
$column['type'] = Type::getType($mapping['type']); $column['type'] = Type::getType($mapping['type']);
...@@ -176,7 +176,7 @@ class SchemaTool ...@@ -176,7 +176,7 @@ class SchemaTool
private function _gatherRelationsSql($class, array &$sql, array &$columns, array &$constraints) private function _gatherRelationsSql($class, array &$sql, array &$columns, array &$constraints)
{ {
foreach ($class->getAssociationMappings() as $mapping) { foreach ($class->associationMappings as $mapping) {
$foreignClass = $this->_em->getClassMetadata($mapping->getTargetEntityName()); $foreignClass = $this->_em->getClassMetadata($mapping->getTargetEntityName());
if ($mapping->isOneToOne() && $mapping->isOwningSide()) { if ($mapping->isOneToOne() && $mapping->isOwningSide()) {
$constraint = array(); $constraint = array();
......
...@@ -339,8 +339,8 @@ class UnitOfWork implements PropertyChangedListener ...@@ -339,8 +339,8 @@ class UnitOfWork implements PropertyChangedListener
if ($this->getEntityState($entity) == self::STATE_MANAGED) { if ($this->getEntityState($entity) == self::STATE_MANAGED) {
$this->_computeEntityChanges($class, $entity); $this->_computeEntityChanges($class, $entity);
// Look for changes in associations of the entity // Look for changes in associations of the entity
foreach ($class->getAssociationMappings() as $assoc) { foreach ($class->associationMappings as $assoc) {
$val = $class->getReflectionProperty($assoc->getSourceFieldName())->getValue($entity); $val = $class->reflFields[$assoc->getSourceFieldName()]->getValue($entity);
if ($val !== null) { if ($val !== null) {
$this->_computeAssociationChanges($assoc, $val); $this->_computeAssociationChanges($assoc, $val);
} }
...@@ -406,7 +406,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -406,7 +406,7 @@ class UnitOfWork implements PropertyChangedListener
if ( ! $coll->isEmpty()) { if ( ! $coll->isEmpty()) {
$coll->setDirty(true); $coll->setDirty(true);
} }
$class->getReflectionProperty($name)->setValue($entity, $coll); $class->reflFields[$name]->setValue($entity, $coll);
$actualData[$name] = $coll; $actualData[$name] = $coll;
} }
} }
...@@ -541,7 +541,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -541,7 +541,7 @@ class UnitOfWork implements PropertyChangedListener
// $persister->executeInserts() at the end to allow easy prepared // $persister->executeInserts() at the end to allow easy prepared
// statement reuse and maybe bulk operations in the persister. // statement reuse and maybe bulk operations in the persister.
// Same for update/delete. // Same for update/delete.
$className = $class->getClassName(); $className = $class->name;
$persister = $this->getEntityPersister($className); $persister = $this->getEntityPersister($className);
foreach ($this->_entityInsertions as $entity) { foreach ($this->_entityInsertions as $entity) {
if (get_class($entity) == $className) { if (get_class($entity) == $className) {
...@@ -550,7 +550,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -550,7 +550,7 @@ class UnitOfWork implements PropertyChangedListener
// Persister returned a post-insert ID // Persister returned a post-insert ID
$oid = spl_object_hash($entity); $oid = spl_object_hash($entity);
$idField = $class->getSingleIdentifierFieldName(); $idField = $class->getSingleIdentifierFieldName();
$class->getReflectionProperty($idField)->setValue($entity, $returnVal); $class->reflFields[$idField]->setValue($entity, $returnVal);
$this->_entityIdentifiers[$oid] = array($returnVal); $this->_entityIdentifiers[$oid] = array($returnVal);
$this->_entityStates[$oid] = self::STATE_MANAGED; $this->_entityStates[$oid] = self::STATE_MANAGED;
$this->_originalEntityData[$oid][$idField] = $returnVal; $this->_originalEntityData[$oid][$idField] = $returnVal;
...@@ -567,7 +567,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -567,7 +567,7 @@ class UnitOfWork implements PropertyChangedListener
*/ */
private function _executeUpdates($class) private function _executeUpdates($class)
{ {
$className = $class->getClassName(); $className = $class->name;
$persister = $this->getEntityPersister($className); $persister = $this->getEntityPersister($className);
foreach ($this->_entityUpdates as $entity) { foreach ($this->_entityUpdates as $entity) {
if (get_class($entity) == $className) { if (get_class($entity) == $className) {
...@@ -583,7 +583,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -583,7 +583,7 @@ class UnitOfWork implements PropertyChangedListener
*/ */
private function _executeDeletions($class) private function _executeDeletions($class)
{ {
$className = $class->getClassName(); $className = $class->name;
$persister = $this->getEntityPersister($className); $persister = $this->getEntityPersister($className);
foreach ($this->_entityDeletions as $entity) { foreach ($this->_entityDeletions as $entity) {
if (get_class($entity) == $className) { if (get_class($entity) == $className) {
...@@ -626,11 +626,11 @@ class UnitOfWork implements PropertyChangedListener ...@@ -626,11 +626,11 @@ class UnitOfWork implements PropertyChangedListener
// Calculate dependencies for new nodes // Calculate dependencies for new nodes
foreach ($newNodes as $node) { foreach ($newNodes as $node) {
$class = $node->getClass(); $class = $node->getClass();
foreach ($class->getAssociationMappings() as $assocMapping) { foreach ($class->associationMappings as $assocMapping) {
//TODO: should skip target classes that are not in the changeset. //TODO: should skip target classes that are not in the changeset.
if ($assocMapping->isOwningSide()) { if ($assocMapping->isOwningSide()) {
$targetClass = $this->_em->getClassMetadata($assocMapping->getTargetEntityName()); $targetClass = $this->_em->getClassMetadata($assocMapping->getTargetEntityName());
$targetClassName = $targetClass->getClassName(); $targetClassName = $targetClass->name;
// If the target class does not yet have a node, create it // If the target class does not yet have a node, create it
if ( ! $this->_commitOrderCalculator->hasNodeWithKey($targetClassName)) { if ( ! $this->_commitOrderCalculator->hasNodeWithKey($targetClassName)) {
$this->_commitOrderCalculator->addNodeWithItem( $this->_commitOrderCalculator->addNodeWithItem(
...@@ -838,7 +838,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -838,7 +838,7 @@ class UnitOfWork implements PropertyChangedListener
throw DoctrineException::updateMe("Entity with oid '" . spl_object_hash($entity) throw DoctrineException::updateMe("Entity with oid '" . spl_object_hash($entity)
. "' has no identity and therefore can't be added to the identity map."); . "' has no identity and therefore can't be added to the identity map.");
} }
$className = $classMetadata->getRootClassName(); $className = $classMetadata->rootEntityName;
if (isset($this->_identityMap[$className][$idHash])) { if (isset($this->_identityMap[$className][$idHash])) {
return false; return false;
} }
...@@ -891,7 +891,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -891,7 +891,7 @@ class UnitOfWork implements PropertyChangedListener
throw DoctrineException::updateMe("Entity with oid '" . spl_object_hash($entity) throw DoctrineException::updateMe("Entity with oid '" . spl_object_hash($entity)
. "' has no identity and therefore can't be removed from the identity map."); . "' has no identity and therefore can't be removed from the identity map.");
} }
$className = $classMetadata->getRootClassName(); $className = $classMetadata->rootEntityName;
if (isset($this->_identityMap[$className][$idHash])) { if (isset($this->_identityMap[$className][$idHash])) {
unset($this->_identityMap[$className][$idHash]); unset($this->_identityMap[$className][$idHash]);
$this->_entityStates[$oid] = self::STATE_DETACHED; $this->_entityStates[$oid] = self::STATE_DETACHED;
...@@ -949,7 +949,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -949,7 +949,7 @@ class UnitOfWork implements PropertyChangedListener
} }
return isset($this->_identityMap return isset($this->_identityMap
[$classMetadata->getRootClassName()] [$classMetadata->rootEntityName]
[$idHash] [$idHash]
); );
} }
...@@ -1125,13 +1125,13 @@ class UnitOfWork implements PropertyChangedListener ...@@ -1125,13 +1125,13 @@ class UnitOfWork implements PropertyChangedListener
throw new InvalidArgumentException('New entity passed to merge().'); throw new InvalidArgumentException('New entity passed to merge().');
} }
$managedCopy = $this->tryGetById($id, $class->getRootClassName()); $managedCopy = $this->tryGetById($id, $class->rootEntityName);
if ($managedCopy) { if ($managedCopy) {
if ($this->getEntityState($managedCopy) == self::STATE_DELETED) { if ($this->getEntityState($managedCopy) == self::STATE_DELETED) {
throw new InvalidArgumentException('Can not merge with a deleted entity.'); throw new InvalidArgumentException('Can not merge with a deleted entity.');
} }
} else { } else {
$managedCopy = $this->_em->find($class->getClassName(), $id); $managedCopy = $this->_em->find($class->name, $id);
} }
// Merge state of $entity into existing (managed) entity // Merge state of $entity into existing (managed) entity
...@@ -1151,9 +1151,9 @@ class UnitOfWork implements PropertyChangedListener ...@@ -1151,9 +1151,9 @@ class UnitOfWork implements PropertyChangedListener
$assocField = $assoc->getSourceFieldName(); $assocField = $assoc->getSourceFieldName();
$prevClass = $this->_em->getClassMetadata(get_class($prevManagedCopy)); $prevClass = $this->_em->getClassMetadata(get_class($prevManagedCopy));
if ($assoc->isOneToOne()) { if ($assoc->isOneToOne()) {
$prevClass->getReflectionProperty($assocField)->setValue($prevManagedCopy, $managedCopy); $prevClass->reflFields[$assocField]->setValue($prevManagedCopy, $managedCopy);
} else { } else {
$prevClass->getReflectionProperty($assocField)->getValue($prevManagedCopy)->add($managedCopy); $prevClass->reflFields[$assocField]->getValue($prevManagedCopy)->add($managedCopy);
} }
} }
...@@ -1168,11 +1168,11 @@ class UnitOfWork implements PropertyChangedListener ...@@ -1168,11 +1168,11 @@ class UnitOfWork implements PropertyChangedListener
private function _cascadeMerge($entity, $managedCopy, array &$visited) private function _cascadeMerge($entity, $managedCopy, array &$visited)
{ {
$class = $this->_em->getClassMetadata(get_class($entity)); $class = $this->_em->getClassMetadata(get_class($entity));
foreach ($class->getAssociationMappings() as $assocMapping) { foreach ($class->associationMappings as $assocMapping) {
if ( ! $assocMapping->isCascadeMerge()) { if ( ! $assocMapping->isCascadeMerge()) {
continue; continue;
} }
$relatedEntities = $class->getReflectionProperty($assocMapping->getSourceFieldName()) $relatedEntities = $class->reflFields[$assocMapping->getSourceFieldName()]
->getValue($entity); ->getValue($entity);
if (($relatedEntities instanceof Collection) && count($relatedEntities) > 0) { if (($relatedEntities instanceof Collection) && count($relatedEntities) > 0) {
foreach ($relatedEntities as $relatedEntity) { foreach ($relatedEntities as $relatedEntity) {
...@@ -1193,11 +1193,11 @@ class UnitOfWork implements PropertyChangedListener ...@@ -1193,11 +1193,11 @@ class UnitOfWork implements PropertyChangedListener
private function _cascadeSave($entity, array &$visited, array &$insertNow) private function _cascadeSave($entity, array &$visited, array &$insertNow)
{ {
$class = $this->_em->getClassMetadata(get_class($entity)); $class = $this->_em->getClassMetadata(get_class($entity));
foreach ($class->getAssociationMappings() as $assocMapping) { foreach ($class->associationMappings as $assocMapping) {
if ( ! $assocMapping->isCascadeSave()) { if ( ! $assocMapping->isCascadeSave()) {
continue; continue;
} }
$relatedEntities = $class->getReflectionProperty($assocMapping->getSourceFieldName()) $relatedEntities = $class->reflFields[$assocMapping->getSourceFieldName()]
->getValue($entity); ->getValue($entity);
if (($relatedEntities instanceof Collection || is_array($relatedEntities)) if (($relatedEntities instanceof Collection || is_array($relatedEntities))
&& count($relatedEntities) > 0) { && count($relatedEntities) > 0) {
...@@ -1218,11 +1218,11 @@ class UnitOfWork implements PropertyChangedListener ...@@ -1218,11 +1218,11 @@ class UnitOfWork implements PropertyChangedListener
private function _cascadeDelete($entity, array &$visited) private function _cascadeDelete($entity, array &$visited)
{ {
$class = $this->_em->getClassMetadata(get_class($entity)); $class = $this->_em->getClassMetadata(get_class($entity));
foreach ($class->getAssociationMappings() as $assocMapping) { foreach ($class->associationMappings as $assocMapping) {
if ( ! $assocMapping->isCascadeDelete()) { if ( ! $assocMapping->isCascadeDelete()) {
continue; continue;
} }
$relatedEntities = $class->getReflectionProperty($assocMapping->getSourceFieldName()) $relatedEntities = $class->reflFields[$assocMapping->getSourceFieldName()]
->getValue($entity); ->getValue($entity);
if ($relatedEntities instanceof Collection || is_array($relatedEntities) if ($relatedEntities instanceof Collection || is_array($relatedEntities)
&& count($relatedEntities) > 0) { && count($relatedEntities) > 0) {
...@@ -1312,7 +1312,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -1312,7 +1312,7 @@ class UnitOfWork implements PropertyChangedListener
$id = array(); $id = array();
if ($class->isIdentifierComposite()) { if ($class->isIdentifierComposite()) {
$identifierFieldNames = $class->getIdentifier(); $identifierFieldNames = $class->identifier;
foreach ($identifierFieldNames as $fieldName) { foreach ($identifierFieldNames as $fieldName) {
$id[] = $data[$fieldName]; $id[] = $data[$fieldName];
} }
...@@ -1321,7 +1321,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -1321,7 +1321,7 @@ class UnitOfWork implements PropertyChangedListener
$id = array($data[$class->getSingleIdentifierFieldName()]); $id = array($data[$class->getSingleIdentifierFieldName()]);
$idHash = $id[0]; $idHash = $id[0];
} }
$entity = $this->tryGetByIdHash($idHash, $class->getRootClassName()); $entity = $this->tryGetByIdHash($idHash, $class->rootEntityName);
if ($entity) { if ($entity) {
$oid = spl_object_hash($entity); $oid = spl_object_hash($entity);
$overrideLocalChanges = false; $overrideLocalChanges = false;
...@@ -1338,17 +1338,17 @@ class UnitOfWork implements PropertyChangedListener ...@@ -1338,17 +1338,17 @@ class UnitOfWork implements PropertyChangedListener
if ($overrideLocalChanges) { if ($overrideLocalChanges) {
foreach ($data as $field => $value) { foreach ($data as $field => $value) {
if ($class->hasField($field)) { if (isset($class->reflFields[$field])) {
$class->setFieldValue($entity, $field, $value); $class->reflFields[$field]->setValue($entity, $value);
} }
} }
} else { } else {
foreach ($data as $field => $value) { foreach ($data as $field => $value) {
if ($class->hasField($field)) { if (isset($class->reflFields[$field])) {
$currentValue = $class->getReflectionProperty($field)->getValue($entity); $currentValue = $class->reflFields[$field]->getValue($entity);
if ( ! isset($this->_originalEntityData[$oid][$field]) || if ( ! isset($this->_originalEntityData[$oid][$field]) ||
$currentValue == $this->_originalEntityData[$oid][$field]) { $currentValue == $this->_originalEntityData[$oid][$field]) {
$class->getReflectionProperty($field)->setValue($entity, $value); $class->reflFields[$field]->setValue($entity, $value);
} }
} }
} }
...@@ -1437,7 +1437,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -1437,7 +1437,7 @@ class UnitOfWork implements PropertyChangedListener
*/ */
public function scheduleForDirtyCheck($entity) public function scheduleForDirtyCheck($entity)
{ {
$rootClassName = $this->_em->getClassMetadata(get_class($entity))->getRootClassName(); $rootClassName = $this->_em->getClassMetadata(get_class($entity))->rootEntityName;
$this->_scheduledForDirtyCheck[$rootClassName] = $entity; $this->_scheduledForDirtyCheck[$rootClassName] = $entity;
} }
......
...@@ -735,7 +735,7 @@ class ObjectHydratorTest extends HydrationTest ...@@ -735,7 +735,7 @@ class ObjectHydratorTest extends HydrationTest
) )
); );
for ($i = 4; $i < 1000; ++$i) { for ($i = 4; $i < 10000; ++$i) {
$resultSet[] = array( $resultSet[] = array(
'u__id' => $i, 'u__id' => $i,
'u__status' => 'developer', 'u__status' => 'developer',
......
...@@ -45,7 +45,7 @@ class ResultSetMappingTest extends \Doctrine\Tests\OrmTestCase ...@@ -45,7 +45,7 @@ class ResultSetMappingTest extends \Doctrine\Tests\OrmTestCase
$this->assertTrue($this->_rsm->getClass('u') instanceof ClassMetadata); $this->assertTrue($this->_rsm->getClass('u') instanceof ClassMetadata);
$class = $this->_rsm->getOwningClass('id'); $class = $this->_rsm->getOwningClass('id');
$this->assertTrue($class instanceof ClassMetadata); $this->assertTrue($class instanceof ClassMetadata);
$this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $class->getClassName()); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $class->name);
$this->assertEquals('u', $this->_rsm->getEntityAlias('id')); $this->assertEquals('u', $this->_rsm->getEntityAlias('id'));
$this->assertEquals('u', $this->_rsm->getEntityAlias('status')); $this->assertEquals('u', $this->_rsm->getEntityAlias('status'));
......
...@@ -34,18 +34,18 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase ...@@ -34,18 +34,18 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase
$cmf->setMetadataForClass('Doctrine\Tests\ORM\Mapping\TestEntity1', $cm1); $cmf->setMetadataForClass('Doctrine\Tests\ORM\Mapping\TestEntity1', $cm1);
// Prechecks // Prechecks
$this->assertEquals(array(), $cm1->getParentClasses()); $this->assertEquals(array(), $cm1->parentClasses);
$this->assertEquals('none', $cm1->getInheritanceType()); $this->assertEquals('none', $cm1->inheritanceType);
$this->assertTrue($cm1->hasField('name')); $this->assertTrue($cm1->hasField('name'));
$this->assertEquals(1, count($cm1->getAssociationMappings())); $this->assertEquals(1, count($cm1->associationMappings));
$this->assertEquals('auto', $cm1->getIdGeneratorType()); $this->assertEquals('auto', $cm1->generatorType);
// Go // Go
$cm1 = $cmf->getMetadataFor('Doctrine\Tests\ORM\Mapping\TestEntity1'); $cm1 = $cmf->getMetadataFor('Doctrine\Tests\ORM\Mapping\TestEntity1');
$this->assertEquals(array(), $cm1->getParentClasses()); $this->assertEquals(array(), $cm1->parentClasses);
$this->assertTrue($cm1->hasField('name')); $this->assertTrue($cm1->hasField('name'));
$this->assertEquals('sequence', $cm1->getIdGeneratorType()); $this->assertEquals('sequence', $cm1->generatorType);
} }
} }
......
...@@ -14,11 +14,11 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase ...@@ -14,11 +14,11 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
// Test initial state // Test initial state
$this->assertTrue(count($cm->getReflectionProperties()) == 0); $this->assertTrue(count($cm->getReflectionProperties()) == 0);
$this->assertTrue($cm->getReflectionClass() instanceof \ReflectionClass); $this->assertTrue($cm->reflClass instanceof \ReflectionClass);
$this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->getClassName()); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name);
$this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->getRootClassName()); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->rootEntityName);
$this->assertEquals(array(), $cm->getSubclasses()); $this->assertEquals(array(), $cm->subClasses);
$this->assertEquals(array(), $cm->getParentClasses()); $this->assertEquals(array(), $cm->parentClasses);
// Customize state // Customize state
$cm->setSubclasses(array("One", "Two", "Three")); $cm->setSubclasses(array("One", "Two", "Three"));
...@@ -27,22 +27,22 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase ...@@ -27,22 +27,22 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
$cm->setDiscriminatorColumn(array('name' => 'disc', 'type' => 'integer')); $cm->setDiscriminatorColumn(array('name' => 'disc', 'type' => 'integer'));
$cm->mapOneToOne(array('fieldName' => 'phonenumbers', 'targetEntity' => 'Bar', 'mappedBy' => 'foo')); $cm->mapOneToOne(array('fieldName' => 'phonenumbers', 'targetEntity' => 'Bar', 'mappedBy' => 'foo'));
$this->assertTrue($cm->getAssociationMapping('phonenumbers') instanceof \Doctrine\ORM\Mapping\OneToOneMapping); $this->assertTrue($cm->getAssociationMapping('phonenumbers') instanceof \Doctrine\ORM\Mapping\OneToOneMapping);
$this->assertEquals(1, count($cm->getAssociationMappings())); $this->assertEquals(1, count($cm->associationMappings));
$serialized = serialize($cm); $serialized = serialize($cm);
$cm = unserialize($serialized); $cm = unserialize($serialized);
// Check state // Check state
$this->assertTrue(count($cm->getReflectionProperties()) > 0); $this->assertTrue(count($cm->getReflectionProperties()) > 0);
$this->assertTrue($cm->getReflectionClass() instanceof \ReflectionClass); $this->assertTrue($cm->reflClass instanceof \ReflectionClass);
$this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->getClassName()); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name);
$this->assertEquals('UserParent', $cm->getRootClassName()); $this->assertEquals('UserParent', $cm->rootEntityName);
$this->assertEquals(array('One', 'Two', 'Three'), $cm->getSubclasses()); $this->assertEquals(array('One', 'Two', 'Three'), $cm->subClasses);
$this->assertEquals(array('UserParent'), $cm->getParentClasses()); $this->assertEquals(array('UserParent'), $cm->parentClasses);
$this->assertEquals('UserRepository', $cm->getCustomRepositoryClass()); $this->assertEquals('UserRepository', $cm->getCustomRepositoryClass());
$this->assertEquals(array('name' => 'disc', 'type' => 'integer'), $cm->getDiscriminatorColumn()); $this->assertEquals(array('name' => 'disc', 'type' => 'integer'), $cm->discriminatorColumn);
$this->assertTrue($cm->getAssociationMapping('phonenumbers') instanceof \Doctrine\ORM\Mapping\OneToOneMapping); $this->assertTrue($cm->getAssociationMapping('phonenumbers') instanceof \Doctrine\ORM\Mapping\OneToOneMapping);
$this->assertEquals(1, count($cm->getAssociationMappings())); $this->assertEquals(1, count($cm->associationMappings));
$oneOneMapping = $cm->getAssociationMapping('phonenumbers'); $oneOneMapping = $cm->getAssociationMapping('phonenumbers');
$this->assertEquals('phonenumbers', $oneOneMapping->getSourceFieldName()); $this->assertEquals('phonenumbers', $oneOneMapping->getSourceFieldName());
$this->assertEquals('Doctrine\Tests\Models\CMS\Bar', $oneOneMapping->getTargetEntityName()); $this->assertEquals('Doctrine\Tests\Models\CMS\Bar', $oneOneMapping->getTargetEntityName());
......
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