[DDC-2423] Fixed bug with EntityGenerator not generating fetch="" attribute in association annotations.
This commit is contained in:
parent
acbafd081b
commit
e3b8ce7737
@ -1274,6 +1274,15 @@ public function __construct()
|
||||
$typeOptions[] = 'orphanRemoval=' . ($associationMapping['orphanRemoval'] ? 'true' : 'false');
|
||||
}
|
||||
|
||||
if (isset($associationMapping['fetch']) && $associationMapping['fetch'] !== ClassMetadataInfo::FETCH_LAZY) {
|
||||
$fetchMap = array(
|
||||
ClassMetadataInfo::FETCH_EXTRA_LAZY => 'EXTRA_LAZY',
|
||||
ClassMetadataInfo::FETCH_EAGER => 'EAGER',
|
||||
);
|
||||
|
||||
$typeOptions[] = 'fetch="' . $fetchMap[$associationMapping['fetch']] . '"';
|
||||
}
|
||||
|
||||
$lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . '' . $type . '(' . implode(', ', $typeOptions) . ')';
|
||||
|
||||
if (isset($associationMapping['joinColumns']) && $associationMapping['joinColumns']) {
|
||||
|
@ -64,6 +64,7 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase
|
||||
$metadata->mapManyToMany(array(
|
||||
'fieldName' => 'comments',
|
||||
'targetEntity' => 'Doctrine\Tests\ORM\Tools\EntityGeneratorComment',
|
||||
'fetch' => ClassMetadataInfo::FETCH_EXTRA_LAZY,
|
||||
'joinTable' => array(
|
||||
'name' => 'book_comment',
|
||||
'joinColumns' => array(array('name' => 'book_id', 'referencedColumnName' => 'id')),
|
||||
@ -223,6 +224,8 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase
|
||||
$this->assertEquals($cm->identifier, $metadata->identifier);
|
||||
$this->assertEquals($cm->idGenerator, $metadata->idGenerator);
|
||||
$this->assertEquals($cm->customRepositoryClassName, $metadata->customRepositoryClassName);
|
||||
|
||||
$this->assertEquals(ClassMetadataInfo::FETCH_EXTRA_LAZY, $cm->associationMappings['comments']['fetch']);
|
||||
}
|
||||
|
||||
public function testLoadPrefixedMetadata()
|
||||
|
Loading…
x
Reference in New Issue
Block a user