Merge branch 'DDC-945-2'
This commit is contained in:
commit
e1ed0bf52a
@ -382,7 +382,7 @@ class ClassMetadataFactory
|
||||
{
|
||||
foreach ($parentClass->associationMappings as $field => $mapping) {
|
||||
if ($parentClass->isMappedSuperclass) {
|
||||
if ($mapping['type'] & ClassMetadata::TO_MANY) {
|
||||
if ($mapping['type'] & ClassMetadata::TO_MANY && !$mapping['isOwningSide']) {
|
||||
throw MappingException::illegalToManyAssocationOnMappedSuperclass($parentClass->name, $field);
|
||||
}
|
||||
$mapping['sourceEntity'] = $subClass->name;
|
||||
|
@ -229,6 +229,6 @@ class MappingException extends \Doctrine\ORM\ORMException
|
||||
|
||||
public static function illegalToManyAssocationOnMappedSuperclass($className, $field)
|
||||
{
|
||||
return new self("It is illegal to put a one-to-many or many-to-many association on mapped superclass '".$className."#".$field."'.");
|
||||
return new self("It is illegal to put an inverse side one-to-many or many-to-many association on mapped superclass '".$className."#".$field."'.");
|
||||
}
|
||||
}
|
@ -145,7 +145,7 @@ class AnnotationDriverTest extends AbstractMappingDriverTest
|
||||
$factory->setEntityManager($em);
|
||||
|
||||
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException',
|
||||
"It is illegal to put a one-to-many or many-to-many association on ".
|
||||
"It is illegal to put an inverse side one-to-many or many-to-many association on ".
|
||||
"mapped superclass 'Doctrine\Tests\ORM\Mapping\InvalidMappedSuperClass#users'");
|
||||
$usingInvalidMsc = $factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\UsingInvalidMappedSuperClass');
|
||||
}
|
||||
@ -166,7 +166,7 @@ class ColumnWithoutType
|
||||
class InvalidMappedSuperClass
|
||||
{
|
||||
/**
|
||||
* @ManyToMany(targetEntity="Doctrine\Tests\Models\CMS\CmsUser")
|
||||
* @ManyToMany(targetEntity="Doctrine\Tests\Models\CMS\CmsUser", mappedBy="invalid")
|
||||
*/
|
||||
private $users;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user