Merge branch '3.0.x'
This commit is contained in:
commit
eaa6c2e085
|
@ -4,6 +4,7 @@ php:
|
|||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
|
||||
before_script:
|
||||
- sudo /usr/share/elasticsearch/bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/2.0.0
|
||||
|
|
|
@ -128,6 +128,8 @@ class FOSElasticaExtension extends Extension
|
|||
*/
|
||||
private function loadIndexes(array $indexes, ContainerBuilder $container)
|
||||
{
|
||||
$indexableCallbacks = array();
|
||||
|
||||
foreach ($indexes as $name => $index) {
|
||||
$indexId = sprintf('fos_elastica.index.%s', $name);
|
||||
$indexName = isset($index['index_name']) ? $index['index_name']: $name;
|
||||
|
@ -159,8 +161,11 @@ class FOSElasticaExtension extends Extension
|
|||
$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 ContainerBuilder $container
|
||||
* @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) {
|
||||
$indexName = $indexConfig['name'];
|
||||
|
||||
|
@ -269,9 +273,6 @@ class FOSElasticaExtension extends Extension
|
|||
$container->setDefinition($typeSerializerId, $typeSerializerDef);
|
||||
}
|
||||
}
|
||||
|
||||
$indexable = $container->getDefinition('fos_elastica.indexable');
|
||||
$indexable->replaceArgument(0, $indexableCallbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ class ElasticaToModelTransformer extends AbstractElasticaToModelTransformer
|
|||
{
|
||||
return $this->registry
|
||||
->getManagerForClass($this->objectClass)
|
||||
->getRepository($this->objectClass)
|
||||
->{$this->options['query_builder_method']}($this->objectClass)
|
||||
->field($this->options['identifier'])->in($identifierValues)
|
||||
->hydrate($hydrate)
|
||||
|
|
|
@ -16,6 +16,13 @@ use FOS\ElasticaBundle\Configuration\TypeConfig;
|
|||
|
||||
class MappingBuilder
|
||||
{
|
||||
/**
|
||||
* Skip adding default information to certain fields.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $skipTypes = array('completion');
|
||||
|
||||
/**
|
||||
* Builds mappings for an entire index.
|
||||
*
|
||||
|
@ -85,12 +92,15 @@ class MappingBuilder
|
|||
if (!isset($property['type'])) {
|
||||
$property['type'] = 'string';
|
||||
}
|
||||
if (!isset($property['store'])) {
|
||||
$property['store'] = true;
|
||||
}
|
||||
if (isset($property['properties'])) {
|
||||
$this->fixProperties($property['properties']);
|
||||
}
|
||||
if (in_array($property['type'], $this->skipTypes)) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($property['store'])) {
|
||||
$property['store'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,8 @@ fos_elastica:
|
|||
type: integer
|
||||
store: false
|
||||
date: { boost: 5 }
|
||||
completion:
|
||||
type: completion
|
||||
title: { boost: 8, analyzer: my_analyzer }
|
||||
content: ~
|
||||
comments:
|
||||
|
|
|
@ -63,3 +63,15 @@ fos_elastica:
|
|||
provider: ~
|
||||
listener:
|
||||
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