1
0
mirror of synced 2024-12-12 22:36:02 +03:00

[2.0] DDC-268 Added missing duplicateAssociationMapping() method to MappingException

This commit is contained in:
beberlei 2010-02-02 21:46:39 +00:00
parent dcfb856dde
commit 7cf8d1ae52
2 changed files with 15 additions and 0 deletions

View File

@ -152,6 +152,10 @@ class MappingException extends \Doctrine\ORM\ORMException
return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once');
}
public static function duplicateAssociationMapping($entity, $fieldName) {
return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once');
}
public static function singleIdNotAllowedOnCompositePrimaryKey($entity) {
return new self('Single id is not allowed on composite primary key in entity '.$entity);
}

View File

@ -137,4 +137,15 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException');
$cm->getSingleIdentifierFieldName();
}
public function testDuplicateAssociationMappingException()
{
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
$a1 = new \Doctrine\ORM\Mapping\OneToOneMapping(array('fieldName' => 'foo', 'sourceEntity' => 'stdClass', 'targetEntity' => 'stdClass', 'joinColumns' => array()));
$a2 = new \Doctrine\ORM\Mapping\OneToOneMapping(array('fieldName' => 'foo', 'sourceEntity' => 'stdClass', 'targetEntity' => 'stdClass', 'joinColumns' => array()));
$cm->addAssociationMapping($a1);
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException');
$cm->addAssociationMapping($a2);
}
}