indexby metadata column
This commit is contained in:
parent
9b0f252aff
commit
6fc18e330d
@ -211,7 +211,7 @@ class ResultSetMapping
|
||||
{
|
||||
$found = false;
|
||||
|
||||
foreach ($this->fieldMappings as $columnName => $columnFieldName) {
|
||||
foreach (array_merge($this->metaMappings, $this->fieldMappings) as $columnName => $columnFieldName) {
|
||||
if ( ! ($columnFieldName === $fieldName && $this->columnOwnerMap[$columnName] === $alias)) continue;
|
||||
|
||||
$this->addIndexByColumn($alias, $columnName);
|
||||
|
@ -255,5 +255,18 @@ class ResultSetMappingTest extends \Doctrine\Tests\OrmTestCase
|
||||
$this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $rsm->getDeclaringClass('status'));
|
||||
$this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $rsm->getDeclaringClass('username'));
|
||||
}
|
||||
public function testIndexByMetadataColumn()
|
||||
{
|
||||
$rms = $this->_rsm;
|
||||
$rms->addEntityResult('Doctrine\Tests\Models\Legacy\LegacyUser', 'u')
|
||||
->addJoinedEntityResult('Doctrine\Tests\Models\Legacy', 'lu', 'u', '_references')
|
||||
->addMetaResult('lu', '_source', '_source', true)
|
||||
->addMetaResult('lu', '_target', '_target', true)
|
||||
->addIndexBy('lu', '_source');
|
||||
|
||||
|
||||
$this->assertTrue($rms->hasIndexBy('lu'));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user