parent
9fbc622929
commit
e5410a5b65
|
@ -128,6 +128,8 @@ class FOSElasticaExtension extends Extension
|
||||||
*/
|
*/
|
||||||
private function loadIndexes(array $indexes, ContainerBuilder $container)
|
private function loadIndexes(array $indexes, ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
|
$indexableCallbacks = array();
|
||||||
|
|
||||||
foreach ($indexes as $name => $index) {
|
foreach ($indexes as $name => $index) {
|
||||||
$indexId = sprintf('fos_elastica.index.%s', $name);
|
$indexId = sprintf('fos_elastica.index.%s', $name);
|
||||||
$indexName = isset($index['index_name']) ? $index['index_name']: $name;
|
$indexName = isset($index['index_name']) ? $index['index_name']: $name;
|
||||||
|
@ -159,8 +161,11 @@ class FOSElasticaExtension extends Extension
|
||||||
$this->loadIndexFinder($container, $name, $reference);
|
$this->loadIndexFinder($container, $name, $reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->loadTypes((array) $index['types'], $container, $this->indexConfigs[$name]);
|
$this->loadTypes((array) $index['types'], $container, $this->indexConfigs[$name], $indexableCallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$indexable = $container->getDefinition('fos_elastica.indexable');
|
||||||
|
$indexable->replaceArgument(0, $indexableCallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -194,11 +199,10 @@ class FOSElasticaExtension extends Extension
|
||||||
* @param array $types
|
* @param array $types
|
||||||
* @param ContainerBuilder $container
|
* @param ContainerBuilder $container
|
||||||
* @param array $indexConfig
|
* @param array $indexConfig
|
||||||
|
* @param array $indexableCallbacks
|
||||||
*/
|
*/
|
||||||
private function loadTypes(array $types, ContainerBuilder $container, array $indexConfig)
|
private function loadTypes(array $types, ContainerBuilder $container, array $indexConfig, array &$indexableCallbacks)
|
||||||
{
|
{
|
||||||
$indexableCallbacks = array();
|
|
||||||
|
|
||||||
foreach ($types as $name => $type) {
|
foreach ($types as $name => $type) {
|
||||||
$indexName = $indexConfig['name'];
|
$indexName = $indexConfig['name'];
|
||||||
|
|
||||||
|
@ -269,9 +273,6 @@ class FOSElasticaExtension extends Extension
|
||||||
$container->setDefinition($typeSerializerId, $typeSerializerDef);
|
$container->setDefinition($typeSerializerId, $typeSerializerDef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$indexable = $container->getDefinition('fos_elastica.indexable');
|
|
||||||
$indexable->replaceArgument(0, $indexableCallbacks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -63,3 +63,15 @@ fos_elastica:
|
||||||
provider: ~
|
provider: ~
|
||||||
listener:
|
listener:
|
||||||
is_indexable_callback: [ 'FOS\ElasticaBundle\Tests\Functional\app\ORM\IndexableService', 'isntIndexable' ]
|
is_indexable_callback: [ 'FOS\ElasticaBundle\Tests\Functional\app\ORM\IndexableService', 'isntIndexable' ]
|
||||||
|
second_index:
|
||||||
|
index_name: foselastica_orm_test_second_%kernel.environment%
|
||||||
|
types:
|
||||||
|
type:
|
||||||
|
properties:
|
||||||
|
field1: ~
|
||||||
|
coll: ~
|
||||||
|
persistence:
|
||||||
|
driver: orm
|
||||||
|
model: FOS\ElasticaBundle\Tests\Functional\TypeObj
|
||||||
|
listener:
|
||||||
|
is_indexable_callback: 'object.isIndexable() && !object.isntIndexable()'
|
||||||
|
|
Loading…
Reference in a new issue