1
0
mirror of synced 2024-12-13 22:56:04 +03:00

Merge branch 'DDC-945-2'

This commit is contained in:
Benjamin Eberlei 2010-12-31 14:39:13 +01:00
commit e1ed0bf52a
3 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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."'.");
}
}

View File

@ -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;
}