Merge branch '3.0.x'
This commit is contained in:
commit
1cea135dc5
|
@ -12,8 +12,9 @@ https://github.com/FriendsOfSymfony/FOSElasticaBundle/compare/v3.0.0...v3.0.1
|
|||
To generate a changelog summary since the last version, run
|
||||
`git log --no-merges --oneline v3.0.0...3.0.x`
|
||||
|
||||
* 3.0.7 (Unreleased)
|
||||
* 3.0.7 (2015-01-21)
|
||||
|
||||
* Fixed the indexing of parent/child relations, broken since 3.0 #774
|
||||
* Fixed multi_field properties not being normalised #769
|
||||
|
||||
* 3.0.6 (2015-01-04)
|
||||
|
|
|
@ -396,7 +396,13 @@ class FOSElasticaExtension extends Extension
|
|||
$arguments[] = array(new Reference($callbackId), 'serialize');
|
||||
} else {
|
||||
$abstractId = 'fos_elastica.object_persister';
|
||||
$arguments[] = $this->indexConfigs[$indexName]['types'][$typeName]['mapping']['properties'];
|
||||
$mapping = $this->indexConfigs[$indexName]['types'][$typeName]['mapping'];
|
||||
$argument = $mapping['properties'];
|
||||
if(isset($mapping['_parent'])){
|
||||
$argument['_parent'] = $mapping['_parent'];
|
||||
}
|
||||
$arguments[] = $argument;
|
||||
|
||||
}
|
||||
|
||||
$serviceId = sprintf('fos_elastica.object_persister.%s.%s', $indexName, $typeName);
|
||||
|
|
32
Tests/DependencyInjection/FOSElasticaExtensionTest.php
Normal file
32
Tests/DependencyInjection/FOSElasticaExtensionTest.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace FOS\ElasticaBundle\Tests\DependencyInjection;
|
||||
|
||||
use FOS\ElasticaBundle\DependencyInjection\FOSElasticaExtension;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class FOSElasticaExtensionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testShouldAddParentParamToObjectPersisterCall()
|
||||
{
|
||||
$config = Yaml::parse(file_get_contents(__DIR__.'/fixtures/config.yml'));
|
||||
|
||||
$containerBuilder = new ContainerBuilder;
|
||||
$containerBuilder->setParameter('kernel.debug', true);
|
||||
|
||||
$extension = new FOSElasticaExtension;
|
||||
|
||||
$extension->load($config, $containerBuilder);
|
||||
|
||||
$this->assertTrue($containerBuilder->hasDefinition('fos_elastica.object_persister.test_index.child_field'));
|
||||
|
||||
$persisterCallDefinition = $containerBuilder->getDefinition('fos_elastica.object_persister.test_index.child_field');
|
||||
|
||||
$arguments = $persisterCallDefinition->getArguments();
|
||||
$arguments = $arguments['index_3'];
|
||||
|
||||
$this->assertArrayHasKey('_parent', $arguments);
|
||||
$this->assertEquals('parent_field', $arguments['_parent']['type']);
|
||||
}
|
||||
}
|
21
Tests/DependencyInjection/fixtures/config.yml
Normal file
21
Tests/DependencyInjection/fixtures/config.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
fos_elastica:
|
||||
clients:
|
||||
default:
|
||||
url: http://localhost:9200
|
||||
indexes:
|
||||
test_index:
|
||||
client: default
|
||||
types:
|
||||
parent_field:
|
||||
mappings:
|
||||
text: ~
|
||||
persistence:
|
||||
driver: orm
|
||||
model: foo_model
|
||||
child_field:
|
||||
mappings:
|
||||
text: ~
|
||||
persistence:
|
||||
driver: orm
|
||||
model: foo_model
|
||||
_parent: { type: "parent_field", property: "parent" }
|
Loading…
Reference in a new issue