Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[DDC-388] Fixed.

  • Loading branch information...
commit d4232d906e433b1fe4dd8aa85aa7a4aca3a2cf4c 1 parent 7fefe3f
@romanb romanb authored
View
7 lib/Doctrine/ORM/AbstractQuery.php
@@ -410,12 +410,7 @@ public function getSingleResult($hydrationMode = null)
throw new NonUniqueResultException;
}
return array_shift($result);
- }/* else if (is_object($result)) {
- if (count($result) > 1) {
- throw new NonUniqueResultException;
- }
- return $result->first();
- }*/
+ }
return $result;
}
View
29 lib/Doctrine/ORM/Mapping/AssociationMapping.php
@@ -1,7 +1,5 @@
<?php
/*
- * $Id$
- *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -152,7 +150,23 @@
*
* @var array
*/
- public $joinTable = array();
+ public $joinTable;
+
+ /**
+ * READ-ONLY: The name of the entity class from which the association was
+ * inherited in an inheritance hierarchy.
+ *
+ * @var string
+ */
+ public $inherited;
+
+ /**
+ * READ-ONLY: The name of the entity or mapped superclass that declares
+ * the association field in an inheritance hierarchy.
+ *
+ * @var string
+ */
+ public $declared;
/**
* Initializes a new instance of a class derived from AssociationMapping.
@@ -161,9 +175,7 @@
*/
public function __construct(array $mapping)
{
- if ($mapping) {
- $this->_validateAndCompleteMapping($mapping);
- }
+ $this->_validateAndCompleteMapping($mapping);
}
/**
@@ -317,8 +329,9 @@ public function hasCascades()
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)
View
44 lib/Doctrine/ORM/Mapping/ClassMetadata.php
@@ -1,7 +1,5 @@
<?php
/*
- * $Id$
- *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -72,11 +70,10 @@ class ClassMetadata extends ClassMetadataInfo
*/
public function __construct($entityName)
{
- $this->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;
}
/**
@@ -100,18 +97,6 @@ public function getReflectionProperties()
}
/**
- * 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.
*
* @param string $name
@@ -189,7 +174,7 @@ public function getIdentifierValues($entity)
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 {
@@ -221,18 +206,6 @@ public function getFieldValue($entity, $field)
}
/**
- * 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.
*
* @param AssociationMapping $assocMapping
@@ -314,7 +287,6 @@ public function __sleep()
'identifier',
'idGenerator', //TODO: Does not really need to be serialized. Could be moved to runtime.
'inheritanceType',
- 'inheritedAssociationFields',
'isIdentifierComposite',
'isMappedSuperclass',
'isVersioned',
@@ -337,10 +309,10 @@ public function __wakeup()
{
// 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 @@ public function __wakeup()
}
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);
}
View
26 lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
@@ -317,31 +317,33 @@ private function _addInheritedFields(ClassMetadata $subClass, ClassMetadata $par
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);
}
}
View
116 lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
@@ -1,7 +1,5 @@
<?php
/*
- * $Id$
- *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -158,7 +156,7 @@ class ClassMetadataInfo
public $parentClasses = array();
/**
- * READ-ONLY: The names of all subclasses.
+ * READ-ONLY: The names of all subclasses (descendants).
*
* @var array
*/
@@ -195,9 +193,9 @@ class ClassMetadataInfo
* - <b>fieldName</b> (string)
* The name of the field in the Entity.
*
- * - <b>type</b> (object Doctrine\DBAL\Types\* or custom type)
- * The type of the column. Can be one of Doctrine's portable types
- * or a custom type.
+ * - <b>type</b> (string)
+ * The type name of the mapped field. Can be one of Doctrine's mapping types
+ * or a custom mapping type.
*
* - <b>columnName</b> (string, optional)
* The column name. Optional. Defaults to the field name.
@@ -207,15 +205,9 @@ class ClassMetadataInfo
* the type.
*
* - <b>id</b> (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.
*
- * - <b>idGenerator</b> (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!
- *
* - <b>nullable</b> (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;
@@ -359,15 +352,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.
*
@@ -593,16 +577,6 @@ protected function _validateAndCompleteFieldMapping(array &$mapping)
}
/**
- * Maps an embedded value object.
- *
- * @todo Implementation.
- */
- /*public function mapEmbeddedValue()
- {
- //...
- }*/
-
- /**
* Gets the identifier (primary key) field names of the class.
*
* @return mixed
@@ -708,7 +682,7 @@ public function setIdGeneratorType($generatorType)
/**
* 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 @@ public function usesIdGenerator()
}
/**
- *
* @return boolean
*/
public function isInheritanceTypeNone()
@@ -857,16 +830,6 @@ public function setSubclasses(array $subclasses)
}
/**
- * 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:
* directParent -> directParentParent -> directParentParentParent ... -> root.
@@ -880,16 +843,6 @@ public function setParentClasses(array $classNames)
}
/**
- * 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.
*
* @param integer $type
@@ -903,7 +856,7 @@ public function setInheritanceType($type)
}
/**
- * 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 @@ public function isInheritedField($fieldName)
*/
public function isInheritedAssociation($fieldName)
{
- return isset($this->inheritedAssociationFields[$fieldName]);
+ return isset($this->associationMappings[$fieldName]->inherited);
}
/**
@@ -964,21 +917,6 @@ private function _isInheritanceType($type)
}
/**
- * 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 @@ private function _completeAssociationMapping(array $mapping)
}
/**
- * Adds a field mapping.
+ * Adds a mapped field to the class.
*
* @param array $mapping The field mapping.
*/
@@ -1015,18 +953,13 @@ public function mapField(array $mapping)
*
* @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 @@ public function addAssociationMapping(AssociationMapping $mapping, $owningClassN
* @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 @@ public function setCustomRepositoryClass($repositoryClassName)
* 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)
{
@@ -1226,17 +1159,6 @@ public function setDiscriminatorMap(array $map)
}
/**
- * 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.
*
* @param string $fieldName
@@ -1304,7 +1226,7 @@ public function setSequenceGeneratorDefinition(array $definition)
/**
* 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
*/
View
22 lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php
@@ -78,14 +78,10 @@ private function _getVersionedClassMetadata()
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 @@ protected function _getSelectEntitiesSQL(array &$criteria, $assoc = null, $order
// 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 @@ protected function _getSelectEntitiesSQL(array &$criteria, $assoc = null, $order
// 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 @@ protected function _getInsertColumnList()
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;
}
View
4 lib/Doctrine/ORM/Persisters/SingleTablePersister.php
@@ -1,7 +1,5 @@
<?php
/*
- * $Id$
- *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -63,7 +61,7 @@ protected function _getSelectColumnListSQL()
// Append subclass foreign keys
foreach ($subClass->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";
View
1  lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
@@ -695,6 +695,7 @@ protected function _getCollectionOrderBySQL(array $orderBy, $baseTableAlias)
$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 .= ', ';
View
9 lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php
@@ -1,7 +1,5 @@
<?php
/*
- * $Id$
- *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -29,11 +27,8 @@
* Executes the SQL statements for bulk DQL UPDATE statements on classes in
* Class Table Inheritance (JOINED).
*
- * @author Roman Borschel <roman@code-factory.org>
- * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
- * @link http://www.doctrine-project.org
- * @since 2.0
- * @version $Revision$
+ * @author Roman Borschel <roman@code-factory.org>
+ * @since 2.0
*/
class MultiTableUpdateExecutor extends AbstractSqlExecutor
{
View
10 lib/Doctrine/ORM/Query/SqlWalker.php
@@ -466,8 +466,8 @@ public function walkPathExpression($pathExpr)
$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 @@ public function walkSelectClause($selectClause)
//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 @@ public function walkSelectExpression($selectExpression)
// 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);
View
2  lib/Doctrine/ORM/Tools/SchemaTool.php
@@ -347,7 +347,7 @@ private function _gatherColumn($class, array $mapping, $table)
private function _gatherRelationsSql($class, $table, $schema)
{
foreach ($class->associationMappings as $fieldName => $mapping) {
- if (isset($class->inheritedAssociationFields[$fieldName])) {
+ if ($mapping->inherited) {
continue;
}
View
126 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 "<packageName>.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 <title> 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
View
2  tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php
@@ -48,7 +48,6 @@ public function testGetMetadataForSubclassWithMappedSuperclass()
$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 @@ public function testSerializationWithPrivateFieldsFromMappedSuperclass()
$this->assertTrue(isset($class2->reflFields['mapped1']));
$this->assertTrue(isset($class2->reflFields['mapped2']));
+ $this->assertTrue(isset($class2->reflFields['mappedRelated1']));
}
}
View
4 tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php
@@ -162,9 +162,9 @@ public function testDuplicateAssociationMappingException()
$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()
Please sign in to comment.
Something went wrong with that request. Please try again.