From d4232d906e433b1fe4dd8aa85aa7a4aca3a2cf4c Mon Sep 17 00:00:00 2001 From: "Roman S. Borschel" Date: Wed, 14 Apr 2010 17:07:08 +0200 Subject: [PATCH] [DDC-388] Fixed. --- lib/Doctrine/ORM/AbstractQuery.php | 7 +- .../ORM/Mapping/AssociationMapping.php | 29 ++-- lib/Doctrine/ORM/Mapping/ClassMetadata.php | 44 ++---- .../ORM/Mapping/ClassMetadataFactory.php | 26 ++-- .../ORM/Mapping/ClassMetadataInfo.php | 116 +++------------- .../Persisters/JoinedSubclassPersister.php | 22 ++- .../ORM/Persisters/SingleTablePersister.php | 4 +- .../Persisters/StandardEntityPersister.php | 1 + .../Query/Exec/MultiTableUpdateExecutor.php | 9 +- lib/Doctrine/ORM/Query/SqlWalker.php | 10 +- lib/Doctrine/ORM/Tools/SchemaTool.php | 2 +- phpdoc.ini | 126 ++++++++++++++++++ .../Mapping/BasicInheritanceMappingTest.php | 2 +- .../Tests/ORM/Mapping/ClassMetadataTest.php | 4 +- 14 files changed, 211 insertions(+), 191 deletions(-) create mode 100644 phpdoc.ini diff --git a/lib/Doctrine/ORM/AbstractQuery.php b/lib/Doctrine/ORM/AbstractQuery.php index 5acf82d0b..9ad032bec 100644 --- a/lib/Doctrine/ORM/AbstractQuery.php +++ b/lib/Doctrine/ORM/AbstractQuery.php @@ -410,12 +410,7 @@ abstract class AbstractQuery throw new NonUniqueResultException; } return array_shift($result); - }/* else if (is_object($result)) { - if (count($result) > 1) { - throw new NonUniqueResultException; - } - return $result->first(); - }*/ + } return $result; } diff --git a/lib/Doctrine/ORM/Mapping/AssociationMapping.php b/lib/Doctrine/ORM/Mapping/AssociationMapping.php index 0e5daaff7..18915ba3c 100644 --- a/lib/Doctrine/ORM/Mapping/AssociationMapping.php +++ b/lib/Doctrine/ORM/Mapping/AssociationMapping.php @@ -1,7 +1,5 @@ _validateAndCompleteMapping($mapping); - } + $this->_validateAndCompleteMapping($mapping); } /** @@ -317,8 +329,9 @@ abstract class AssociationMapping abstract public function load($sourceEntity, $target, $em, array $joinColumnValues = array()); /** - * - * @param $platform + * Gets the (possibly quoted) name of the join table. + * + * @param AbstractPlatform $platform * @return string */ public function getQuotedJoinTableName($platform) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadata.php b/lib/Doctrine/ORM/Mapping/ClassMetadata.php index 6ac796adc..c358cc007 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadata.php @@ -1,7 +1,5 @@ name = $entityName; - $this->reflClass = new \ReflectionClass($entityName); + parent::__construct($entityName); + $this->reflClass = new ReflectionClass($entityName); $this->namespace = $this->reflClass->getNamespaceName(); $this->table['name'] = $this->reflClass->getShortName(); - $this->rootEntityName = $entityName; } /** @@ -99,18 +96,6 @@ class ClassMetadata extends ClassMetadataInfo return $this->reflFields; } - /** - * INTERNAL: - * Adds a reflection property. Usually only used by the ClassMetadataFactory - * while processing inheritance mappings. - * - * @param array $props - */ - public function addReflectionProperty($propName, \ReflectionProperty $property) - { - $this->reflFields[$propName] = $property; - } - /** * Gets a ReflectionProperty for a specific field of the mapped class. * @@ -189,7 +174,7 @@ class ClassMetadata extends ClassMetadataInfo public function setIdentifierValues($entity, $id) { if ($this->isIdentifierComposite) { - foreach ((array)$id as $idField => $idValue) { + foreach ($id as $idField => $idValue) { $this->reflFields[$idField]->setValue($entity, $idValue); } } else { @@ -220,18 +205,6 @@ class ClassMetadata extends ClassMetadataInfo return $this->reflFields[$field]->getValue($entity); } - /** - * Sets the field mapped to the specified column to the specified value on the given entity. - * - * @param object $entity - * @param string $field - * @param mixed $value - */ - public function setColumnValue($entity, $column, $value) - { - $this->reflFields[$this->fieldNames[$column]]->setValue($entity, $value); - } - /** * Stores the association mapping. * @@ -314,7 +287,6 @@ class ClassMetadata extends ClassMetadataInfo 'identifier', 'idGenerator', //TODO: Does not really need to be serialized. Could be moved to runtime. 'inheritanceType', - 'inheritedAssociationFields', 'isIdentifierComposite', 'isMappedSuperclass', 'isVersioned', @@ -337,10 +309,10 @@ class ClassMetadata extends ClassMetadataInfo { // Restore ReflectionClass and properties $this->reflClass = new ReflectionClass($this->name); - + foreach ($this->fieldMappings as $field => $mapping) { - if (isset($mapping['inherited'])) { - $reflField = new ReflectionProperty($mapping['inherited'], $field); + if (isset($mapping['declared'])) { + $reflField = new ReflectionProperty($mapping['declared'], $field); } else { $reflField = $this->reflClass->getProperty($field); } @@ -349,8 +321,8 @@ class ClassMetadata extends ClassMetadataInfo } foreach ($this->associationMappings as $field => $mapping) { - if (isset($this->inheritedAssociationFields[$field])) { - $reflField = new ReflectionProperty($this->inheritedAssociationFields[$field], $field); + if ($mapping->declared) { + $reflField = new ReflectionProperty($mapping->declared, $field); } else { $reflField = $this->reflClass->getProperty($field); } diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php index 13ca40840..69836e88a 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php @@ -317,31 +317,33 @@ class ClassMetadataFactory if ( ! isset($mapping['inherited']) && ! $parentClass->isMappedSuperclass) { $mapping['inherited'] = $parentClass->name; } - $subClass->addFieldMapping($mapping); + if ( ! isset($mapping['declared'])) { + $mapping['declared'] = $parentClass->name; + } + $subClass->addInheritedFieldMapping($mapping); } foreach ($parentClass->reflFields as $name => $field) { $subClass->reflFields[$name] = $field; } } - + /** - * Adds inherited associations to the subclass mapping. + * Adds inherited association mappings to the subclass mapping. * * @param Doctrine\ORM\Mapping\ClassMetadata $subClass * @param Doctrine\ORM\Mapping\ClassMetadata $parentClass */ private function _addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass) { - foreach ($parentClass->associationMappings as $mapping) { - if (isset($parentClass->inheritedAssociationFields[$mapping->sourceFieldName])) { - // parent class also inherited that one - $subClass->addAssociationMapping($mapping, $parentClass->inheritedAssociationFields[$mapping->sourceFieldName]); - } else if ( ! $parentClass->isMappedSuperclass) { - // parent class defined that one - $subClass->addAssociationMapping($mapping, $parentClass->name); - } else { - $subClass->addAssociationMapping($mapping); + foreach ($parentClass->associationMappings as $field => $mapping) { + $subclassMapping = clone $mapping; + if ( ! isset($mapping->inherited) && ! $parentClass->isMappedSuperclass) { + $subclassMapping->inherited = $parentClass->name; } + if ( ! isset($mapping->declared)) { + $subclassMapping->declared = $parentClass->name; + } + $subClass->addInheritedAssociationMapping($subclassMapping); } } diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index b3ed57d98..ac481c48f 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -1,7 +1,5 @@ fieldName (string) * The name of the field in the Entity. * - * - type (object Doctrine\DBAL\Types\* or custom type) - * The type of the column. Can be one of Doctrine's portable types - * or a custom type. + * - type (string) + * The type name of the mapped field. Can be one of Doctrine's mapping types + * or a custom mapping type. * * - columnName (string, optional) * The column name. Optional. Defaults to the field name. @@ -207,15 +205,9 @@ class ClassMetadataInfo * the type. * * - id (boolean, optional) - * Marks the field as the primary key of the Entity. Multiple fields of an + * Marks the field as the primary key of the entity. Multiple fields of an * entity can have the id attribute, forming a composite key. * - * - idGenerator (string, optional) - * Either: idGenerator => 'nameOfGenerator', usually only for TABLE/SEQUENCE generators - * Or: idGenerator => 'identity' or 'auto' or 'table' or 'sequence' - * Note that 'auto', 'table', 'sequence' and 'identity' are reserved names and - * therefore cant be used as a generator name! - * * - nullable (boolean, optional) * Whether the column is nullable. Defaults to FALSE. * @@ -306,7 +298,7 @@ class ClassMetadataInfo public $lifecycleCallbacks = array(); /** - * READ-ONLY: The association mappings. All mappings, inverse and owning side. + * READ-ONLY: The association mappings of this class. * * @var array */ @@ -323,6 +315,7 @@ class ClassMetadataInfo * READ-ONLY: The ID generator used for generating IDs for this class. * * @var AbstractIdGenerator + * @todo Remove */ public $idGenerator; @@ -358,15 +351,6 @@ class ClassMetadataInfo */ public $changeTrackingPolicy = self::CHANGETRACKING_DEFERRED_IMPLICIT; - /** - * READ-ONLY: A map of field names to class names, where the field names are association - * fields that have been inherited from another class and values are the names - * of the classes that define the association. - * - * @var array - */ - public $inheritedAssociationFields = array(); - /** * READ-ONLY: A flag for whether or not instances of this class are to be versioned * with optimistic locking. @@ -592,16 +576,6 @@ class ClassMetadataInfo } } - /** - * Maps an embedded value object. - * - * @todo Implementation. - */ - /*public function mapEmbeddedValue() - { - //... - }*/ - /** * Gets the identifier (primary key) field names of the class. * @@ -708,7 +682,7 @@ class ClassMetadataInfo /** * Checks whether the mapped class uses an Id generator. * - * @return boolean TRUE if the mapped class uses an Id generator, FALSE otherwise. + * @return boolean TRUE if the mapped class uses an Id generator, FALSE otherwise. */ public function usesIdGenerator() { @@ -716,7 +690,6 @@ class ClassMetadataInfo } /** - * * @return boolean */ public function isInheritanceTypeNone() @@ -856,16 +829,6 @@ class ClassMetadataInfo } } - /** - * Checks whether the class has any persistent subclasses. - * - * @return boolean TRUE if the class has one or more persistent subclasses, FALSE otherwise. - */ - public function hasSubclasses() - { - return ! $this->subClasses; - } - /** * Sets the parent class names. * Assumes that the class names in the passed array are in the order: @@ -879,16 +842,6 @@ class ClassMetadataInfo } } - /** - * Checks whether the class has any persistent parent classes. - * - * @return boolean TRUE if the class has one or more persistent parent classes, FALSE otherwise. - */ - public function hasParentClasses() - { - return ! $this->parentClasses; - } - /** * Sets the inheritance type used by the class and it's subclasses. * @@ -903,7 +856,7 @@ class ClassMetadataInfo } /** - * Checks whether a mapped field is inherited from a superclass. + * Checks whether a mapped field is inherited from an entity superclass. * * @return boolean TRUE if the field is inherited, FALSE otherwise. */ @@ -920,7 +873,7 @@ class ClassMetadataInfo */ public function isInheritedAssociation($fieldName) { - return isset($this->inheritedAssociationFields[$fieldName]); + return isset($this->associationMappings[$fieldName]->inherited); } /** @@ -963,21 +916,6 @@ class ClassMetadataInfo $type == self::INHERITANCE_TYPE_TABLE_PER_CLASS; } - /** - * Checks whether the given type identifies an id generator type. - * - * @param string $type - * @return boolean - */ - private function _isIdGeneratorType($type) - { - return $type == self::GENERATOR_TYPE_AUTO || - $type == self::GENERATOR_TYPE_IDENTITY || - $type == self::GENERATOR_TYPE_SEQUENCE || - $type == self::GENERATOR_TYPE_TABLE || - $type == self::GENERATOR_TYPE_NONE; - } - /** * Makes some automatic additions to the association mapping to make the life * easier for the user, and store join columns in the metadata. @@ -995,7 +933,7 @@ class ClassMetadataInfo } /** - * Adds a field mapping. + * Adds a mapped field to the class. * * @param array $mapping The field mapping. */ @@ -1015,18 +953,13 @@ class ClassMetadataInfo * * @param AssociationMapping $mapping * @param string $owningClassName The name of the class that defined this mapping. - * @todo Rename: addInheritedAssociationMapping */ - public function addAssociationMapping(AssociationMapping $mapping, $owningClassName = null) + public function addInheritedAssociationMapping(AssociationMapping $mapping/*, $owningClassName = null*/) { - $sourceFieldName = $mapping->sourceFieldName; - if (isset($this->associationMappings[$sourceFieldName])) { - throw MappingException::duplicateAssociationMapping($this->name, $sourceFieldName); - } - $this->associationMappings[$sourceFieldName] = $mapping; - if ($owningClassName !== null) { - $this->inheritedAssociationFields[$sourceFieldName] = $owningClassName; + if (isset($this->associationMappings[$mapping->sourceFieldName])) { + throw MappingException::duplicateAssociationMapping($this->name, $mapping->sourceFieldName); } + $this->associationMappings[$mapping->sourceFieldName] = $mapping; } /** @@ -1037,7 +970,7 @@ class ClassMetadataInfo * @param array $mapping * @todo Rename: addInheritedFieldMapping */ - public function addFieldMapping(array $fieldMapping) + public function addInheritedFieldMapping(array $fieldMapping) { $this->fieldMappings[$fieldMapping['fieldName']] = $fieldMapping; $this->columnNames[$fieldMapping['fieldName']] = $fieldMapping['columnName']; @@ -1119,8 +1052,8 @@ class ClassMetadataInfo * Dispatches the lifecycle event of the given entity to the registered * lifecycle callbacks and lifecycle listeners. * - * @param string $event The lifecycle event. - * @param Entity $entity The Entity on which the event occured. + * @param string $event The lifecycle event. + * @param Entity $entity The Entity on which the event occured. */ public function invokeLifecycleCallbacks($lifecycleEvent, $entity) { @@ -1225,17 +1158,6 @@ class ClassMetadataInfo } } - /** - * Checks whether the given column name is the discriminator column. - * - * @param string $columnName - * @return boolean - */ - public function isDiscriminatorColumn($columnName) - { - return $columnName === $this->discriminatorColumn['name']; - } - /** * Checks whether the class has a mapped association with the given field name. * @@ -1304,7 +1226,7 @@ class ClassMetadataInfo /** * Sets the version field mapping used for versioning. Sets the default - * value to use depending on the column type + * value to use depending on the column type. * * @param array $mapping The version field mapping array */ diff --git a/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php b/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php index c6e08abf4..9a68749b7 100644 --- a/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php +++ b/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php @@ -78,14 +78,10 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister public function getOwningTable($fieldName) { if ( ! isset($this->_owningTableMap[$fieldName])) { - if (isset($this->_class->associationMappings[$fieldName])) { - if (isset($this->_class->inheritedAssociationFields[$fieldName])) { - $this->_owningTableMap[$fieldName] = $this->_em->getClassMetadata( - $this->_class->inheritedAssociationFields[$fieldName] - )->table['name']; - } else { - $this->_owningTableMap[$fieldName] = $this->_class->table['name']; - } + if (isset($this->_class->associationMappings[$fieldName]->inherited)) { + $this->_owningTableMap[$fieldName] = $this->_em->getClassMetadata( + $this->_class->associationMappings[$fieldName]->inherited + )->table['name']; } else if (isset($this->_class->fieldMappings[$fieldName]['inherited'])) { $this->_owningTableMap[$fieldName] = $this->_em->getClassMetadata( $this->_class->fieldMappings[$fieldName]['inherited'] @@ -252,9 +248,9 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister // Add foreign key columns foreach ($this->_class->associationMappings as $assoc) { if ($assoc->isOwningSide && $assoc->isOneToOne()) { - $tableAlias = isset($this->_class->inheritedAssociationFields[$assoc->sourceFieldName]) ? - $this->_getSQLTableAlias($this->_em->getClassMetadata($this->_class->inheritedAssociationFields[$assoc->sourceFieldName])) - : $baseTableAlias; + $tableAlias = $assoc->inherited ? + $this->_getSQLTableAlias($this->_em->getClassMetadata($assoc->inherited)) + : $baseTableAlias; foreach ($assoc->targetToSourceKeyColumns as $srcColumn) { $columnAlias = $srcColumn . $this->_sqlAliasCounter++; $columnList .= ", $tableAlias.$srcColumn AS $columnAlias"; @@ -308,7 +304,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister // Add join columns (foreign keys) foreach ($subClass->associationMappings as $assoc2) { - if ($assoc2->isOwningSide && $assoc2->isOneToOne() && ! isset($subClass->inheritedAssociationFields[$assoc2->sourceFieldName])) { + if ($assoc2->isOwningSide && $assoc2->isOneToOne() && ! $assoc2->inherited) { foreach ($assoc2->targetToSourceKeyColumns as $srcColumn) { $columnAlias = $srcColumn . $this->_sqlAliasCounter++; $columnList .= ', ' . $tableAlias . ".$srcColumn AS $columnAlias"; @@ -377,7 +373,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister foreach ($this->_class->reflFields as $name => $field) { if (isset($this->_class->fieldMappings[$name]['inherited']) && ! isset($this->_class->fieldMappings[$name]['id']) - || isset($this->_class->inheritedAssociationFields[$name]) + || isset($this->_class->associationMappings[$name]->inherited) || ($this->_class->isVersioned && $this->_class->versionField == $name)) { continue; } diff --git a/lib/Doctrine/ORM/Persisters/SingleTablePersister.php b/lib/Doctrine/ORM/Persisters/SingleTablePersister.php index 81bf6a1f4..a0adbea67 100644 --- a/lib/Doctrine/ORM/Persisters/SingleTablePersister.php +++ b/lib/Doctrine/ORM/Persisters/SingleTablePersister.php @@ -1,7 +1,5 @@ associationMappings as $assoc) { - if ($assoc->isOwningSide && $assoc->isOneToOne() && ! isset($subClass->inheritedAssociationFields[$assoc->sourceFieldName])) { + if ($assoc->isOwningSide && $assoc->isOneToOne() && ! $assoc->inherited) { foreach ($assoc->targetToSourceKeyColumns as $srcColumn) { $columnAlias = $srcColumn . $this->_sqlAliasCounter++; $columnList .= ', ' . $tableAlias . ".$srcColumn AS $columnAlias"; diff --git a/lib/Doctrine/ORM/Persisters/StandardEntityPersister.php b/lib/Doctrine/ORM/Persisters/StandardEntityPersister.php index cea3f37bd..f599cc74b 100644 --- a/lib/Doctrine/ORM/Persisters/StandardEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/StandardEntityPersister.php @@ -695,6 +695,7 @@ class StandardEntityPersister $tableAlias = isset($this->_class->fieldMappings[$fieldName]['inherited']) ? $this->_getSQLTableAlias($this->_em->getClassMetadata($this->_class->fieldMappings[$fieldName]['inherited'])) : $baseTableAlias; + $columnName = $this->_class->getQuotedColumnName($fieldName, $this->_platform); if ($orderBySql != '') { $orderBySql .= ', '; diff --git a/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php b/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php index add39dc83..ee9b1b7f0 100644 --- a/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php +++ b/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php @@ -1,7 +1,5 @@ - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link http://www.doctrine-project.org - * @since 2.0 - * @version $Revision$ + * @author Roman Borschel + * @since 2.0 */ class MultiTableUpdateExecutor extends AbstractSqlExecutor { diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index 15296395b..4bc6c2f6f 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -466,8 +466,8 @@ class SqlWalker implements TreeWalker $dqlAlias = $pathExpr->identificationVariable; $class = $this->_queryComponents[$dqlAlias]['metadata']; - if (isset($class->inheritedAssociationFields[$fieldName])) { - $class = $this->_em->getClassMetadata($class->inheritedAssociationFields[$fieldName]); + if (isset($class->associationMappings[$fieldName]->inherited)) { + $class = $this->_em->getClassMetadata($class->associationMappings[$fieldName]->inherited); } $assoc = $class->associationMappings[$fieldName]; @@ -538,8 +538,8 @@ class SqlWalker implements TreeWalker //FIXME: Include foreign key columns of child classes also!!?? foreach ($class->associationMappings as $assoc) { if ($assoc->isOwningSide && $assoc->isOneToOne()) { - if (isset($class->inheritedAssociationFields[$assoc->sourceFieldName])) { - $owningClass = $this->_em->getClassMetadata($class->inheritedAssociationFields[$assoc->sourceFieldName]); + if ($assoc->inherited) { + $owningClass = $this->_em->getClassMetadata($assoc->inherited); $sqlTableAlias = $this->getSqlTableAlias($owningClass->table['name'], $dqlAlias); } else { $sqlTableAlias = $this->getSqlTableAlias($class->table['name'], $dqlAlias); @@ -958,7 +958,7 @@ class SqlWalker implements TreeWalker // Add join columns (foreign keys) of the subclass //TODO: Probably better do this in walkSelectClause to honor the INCLUDE_META_COLUMNS hint foreach ($subClass->associationMappings as $fieldName => $assoc) { - if ($assoc->isOwningSide && $assoc->isOneToOne() && ! isset($subClass->inheritedAssociationFields[$fieldName])) { + if ($assoc->isOwningSide && $assoc->isOneToOne() && ! $assoc->inherited) { foreach ($assoc->targetToSourceKeyColumns as $srcColumn) { if ($beginning) $beginning = false; else $sql .= ', '; $columnAlias = $this->getSqlColumnAlias($srcColumn); diff --git a/lib/Doctrine/ORM/Tools/SchemaTool.php b/lib/Doctrine/ORM/Tools/SchemaTool.php index 5897e0a72..52942ead7 100644 --- a/lib/Doctrine/ORM/Tools/SchemaTool.php +++ b/lib/Doctrine/ORM/Tools/SchemaTool.php @@ -347,7 +347,7 @@ class SchemaTool private function _gatherRelationsSql($class, $table, $schema) { foreach ($class->associationMappings as $fieldName => $mapping) { - if (isset($class->inheritedAssociationFields[$fieldName])) { + if ($mapping->inherited) { continue; } diff --git a/phpdoc.ini b/phpdoc.ini new file mode 100644 index 000000000..2e2d320ce --- /dev/null +++ b/phpdoc.ini @@ -0,0 +1,126 @@ +; Default configuration file for PHPDoctor + +; This config file will cause PHPDoctor to generate API documentation of +; itself. + + +; PHPDoctor settings +; ----------------------------------------------------------------------------- + +; Names of files to parse. This can be a single filename, or a comma separated +; list of filenames. Wildcards are allowed. + +;files = "*.php" +files = *.php + +; Names of files or directories to ignore. This can be a single filename, or a +; comma separated list of filenames. Wildcards are NOT allowed. + +ignore = "CVS, .svn, .git, _compiled, vendor" + +; The directory to look for files in, if not used the PHPDoctor will look in +; the current directory (the directory it is run from). + +source_path = "./lib" + +; If you do not want PHPDoctor to look in each sub directory for files +; uncomment this line. + +;subdirs = off + +; Set how loud PHPDoctor is as it runs. Quiet mode suppresses all output other +; than warnings and errors. Verbose mode outputs additional messages during +; execution. + +;quiet = on +;verbose = on + +; Select the doclet to use for generating output. + +doclet = standard +;doclet = debug + +; The directory to find the doclet in. Doclets are expected to be in a +; directory named after themselves at the location given. + +;doclet_path = ./doclets + +; The directory to find taglets in. Taglets allow you to make PHPDoctor handle +; new tags and to alter the behavour of existing tags and their output. + +;taglet_path = ./taglets + +; If the code you are parsing does not use package tags or not all elements +; have package tags, use this setting to place unbound elements into a +; particular package. + +default_package = "Doctrine" + +; Specifies the name of a HTML file containing text for the overview +; documentation to be placed on the overview page. The path is relative to +; "source_path" unless an absolute path is given. + +overview = readme.html + +; Package comments will be looked for in a file named package.html in the same +; directory as the first source file parsed in that package or in the directory +; given below. If package comments are placed in the directory given below then +; they should be named ".html". + +package_comment_dir = ./ + +; Parse out global variables and/or global constants? + +;globals = off +;constants = off + +; Generate documentation for all class members + +;private = on + +; Generate documentation for public and protected class members + +protected = on + +; Generate documentation for only public class members + +;public = on + +; Use the PEAR compatible handling of the docblock first sentence + +;pear_compat = on + +; Standard doclet settings +; ----------------------------------------------------------------------------- + +; The directory to place generated documentation in. If the given path is +; relative to it will be relative to "source_path". + +d = "api" + +; Specifies the title to be placed in the HTML tag. + +windowtitle = "Doctrine" + +; Specifies the title to be placed near the top of the overview summary file. + +doctitle = "Doctrine: PHP Object-Relational Mapper" + +; Specifies the header text to be placed at the top of each output file. The +; header will be placed to the right of the upper navigation bar. + +header = "Doctrine" + +; Specifies the footer text to be placed at the bottom of each output file. The +; footer will be placed to the right of the lower navigation bar. + +footer = "Doctrine" + +; Specifies the text to be placed at the bottom of each output file. The text +; will be placed at the bottom of the page, below the lower navigation bar. + +;bottom = "This document was generated by <a href="http://phpdoctor.sourceforge.net/">PHPDoctor: The PHP Documentation Creator</a>" + +; Create a class tree? + +;tree = off diff --git a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php index e7c3bbfb8..fdaf30f41 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php @@ -48,7 +48,6 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase $this->assertFalse(isset($class->fieldMappings['mapped2']['inherited'])); $this->assertFalse(isset($class->fieldMappings['transient'])); - $this->assertTrue(empty($class->inheritedAssociationFields)); $this->assertTrue(isset($class->associationMappings['mappedRelated1'])); } @@ -64,6 +63,7 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase $this->assertTrue(isset($class2->reflFields['mapped1'])); $this->assertTrue(isset($class2->reflFields['mapped2'])); + $this->assertTrue(isset($class2->reflFields['mappedRelated1'])); } } diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index dcc6b8210..b31f5077c 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -162,9 +162,9 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase $a1 = new \Doctrine\ORM\Mapping\OneToOneMapping(array('fieldName' => 'foo', 'sourceEntity' => 'stdClass', 'targetEntity' => 'stdClass', 'mappedBy' => 'foo')); $a2 = new \Doctrine\ORM\Mapping\OneToOneMapping(array('fieldName' => 'foo', 'sourceEntity' => 'stdClass', 'targetEntity' => 'stdClass', 'mappedBy' => 'foo')); - $cm->addAssociationMapping($a1); + $cm->addInheritedAssociationMapping($a1); $this->setExpectedException('Doctrine\ORM\Mapping\MappingException'); - $cm->addAssociationMapping($a2); + $cm->addInheritedAssociationMapping($a2); } public function testDuplicateColumnName_ThrowsMappingException()