1
0
mirror of synced 2025-01-31 12:32:59 +03:00

indexby metadata column

This commit is contained in:
Asmir Mustafic 2013-04-02 10:04:15 +02:00
parent 9b0f252aff
commit 6fc18e330d
2 changed files with 14 additions and 1 deletions

View File

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

View File

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