1
0
mirror of synced 2025-01-09 18:47:10 +03:00

Merge branch 'DDC-2700'

This commit is contained in:
Benjamin Eberlei 2014-01-02 23:50:21 +01:00
commit 22d4d2e812
2 changed files with 24 additions and 0 deletions

View File

@ -1093,9 +1093,14 @@ class ClassMetadataInfo implements ClassMetadata
*/ */
public function isIdentifier($fieldName) public function isIdentifier($fieldName)
{ {
if ( ! $this->identifier) {
return false;
}
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);
} }

View File

@ -1091,6 +1091,25 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
$this->assertEquals(array('sequenceName' => 'foo', 'quoted' => true), $cm->sequenceGeneratorDefinition); $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 class MyNamespacedNamingStrategy extends \Doctrine\ORM\Mapping\DefaultNamingStrategy