diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index 20cf4c2a9..8a1a6587f 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -1093,9 +1093,14 @@ class ClassMetadataInfo implements ClassMetadata */ public function isIdentifier($fieldName) { + if ( ! $this->identifier) { + return false; + } + if ( ! $this->isIdentifierComposite) { return $fieldName === $this->identifier[0]; } + return in_array($fieldName, $this->identifier); } diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index 67bf4c905..aa284db89 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -1091,6 +1091,25 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase $this->assertEquals(array('sequenceName' => 'foo', 'quoted' => true), $cm->sequenceGeneratorDefinition); } + + /** + * @group DDC-2700 + */ + public function testIsIdentifierMappedSuperClass() + { + $class = new ClassMetadata(__NAMESPACE__ . '\\DDC2700MappedSuperClass'); + + $this->assertFalse($class->isIdentifier('foo')); + } +} + +/** + * @MappedSuperclass + */ +class DDC2700MappedSuperClass +{ + /** @Column */ + private $foo; } class MyNamespacedNamingStrategy extends \Doctrine\ORM\Mapping\DefaultNamingStrategy