[2.0] DDC-268 Added missing duplicateAssociationMapping() method to MappingException
This commit is contained in:
parent
dcfb856dde
commit
7cf8d1ae52
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user