Skip to content

Commit 45a384d

Browse files
committed
remove types
Elasticsearch 7 and FOSElasticaBundle 6 no longer use types (only indexes)
1 parent 1ed70a9 commit 45a384d

File tree

6 files changed

+7
-17
lines changed

6 files changed

+7
-17
lines changed

DependencyInjection/Configuration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function getConfigTreeBuilder()
3838
->booleanNode('remove')->defaultTrue()->end()
3939
->scalarNode('connection')->defaultValue('default')->cannotBeEmpty()->end()
4040
->scalarNode('index_name')->isRequired()->cannotBeEmpty()->end()
41-
->scalarNode('type_name')->isRequired()->cannotBeEmpty()->end()
4241
->scalarNode('model_class')->isRequired()->cannotBeEmpty()->end()
4342
->scalarNode('model_id')->defaultValue('id')->cannotBeEmpty()->end()
4443
->scalarNode('repository_method')->defaultValue('find')->cannotBeEmpty()->end()

DependencyInjection/EnqueueElasticaExtension.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ public function load(array $configs, ContainerBuilder $container)
6767

6868
foreach ($config['doctrine']['queue_listeners'] as $listenerConfig) {
6969
$listenerId = sprintf(
70-
'enqueue_elastica.doctrine_queue_listener.%s.%s',
71-
$listenerConfig['index_name'],
72-
$listenerConfig['type_name']
70+
'enqueue_elastica.doctrine_queue_listener.%s',
71+
$listenerConfig['index_name']
7372
);
7473

7574
$container->register($listenerId, SyncIndexWithObjectChangeListener::class)

Doctrine/Queue/SyncIndexWithObjectChangeProcessor.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ public function process(Message $message, Context $context): Result
4949
if (false == isset($data['index_name'])) {
5050
return Result::reject('The message data misses index_name');
5151
}
52-
if (false == isset($data['type_name'])) {
53-
return Result::reject('The message data misses type_name');
54-
}
5552
if (false == isset($data['repository_method'])) {
5653
return Result::reject('The message data misses repository_method');
5754
}
@@ -60,11 +57,10 @@ public function process(Message $message, Context $context): Result
6057
$modelClass = $data['model_class'];
6158
$id = $data['id'];
6259
$index = $data['index_name'];
63-
$type = $data['type_name'];
6460
$repositoryMethod = $data['repository_method'];
6561

6662
$repository = $this->doctrine->getManagerForClass($modelClass)->getRepository($modelClass);
67-
$persister = $this->persisterRegistry->getPersister($index, $type);
63+
$persister = $this->persisterRegistry->getPersister($index);
6864

6965
switch ($action) {
7066
case self::UPDATE_ACTION:
@@ -75,7 +71,7 @@ public function process(Message $message, Context $context): Result
7571
}
7672

7773
if ($persister->handlesObject($object)) {
78-
if ($this->indexable->isObjectIndexable($index, $type, $object)) {
74+
if ($this->indexable->isObjectIndexable($index, $object)) {
7975
$persister->replaceOne($object);
8076
} else {
8177
$persister->deleteOne($object);
@@ -90,7 +86,7 @@ public function process(Message $message, Context $context): Result
9086
return Result::ack(sprintf('The object "%s" with id "%s" could not be found.', $modelClass, $id));
9187
}
9288

93-
if ($persister->handlesObject($object) && $this->indexable->isObjectIndexable($index, $type, $object)) {
89+
if ($persister->handlesObject($object) && $this->indexable->isObjectIndexable($index, $object)) {
9490
$persister->insertOne($object);
9591
}
9692

Doctrine/SyncIndexWithObjectChangeListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ private function sendUpdateIndexMessage($action, $id)
100100
'model_id' => $this->config['model_id'],
101101
'id' => $id,
102102
'index_name' => $this->config['index_name'],
103-
'type_name' => $this->config['type_name'],
104103
'repository_method' => $this->config['repository_method'],
105104
]));
106105

Persister/QueuePagerPersister.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function insert(PagerInterface $pager, array $options = array())
5454

5555
$pager->setCurrentPage($options['first_page']);
5656

57-
$objectPersister = $this->registry->getPersister($options['indexName'], $options['typeName']);
57+
$objectPersister = $this->registry->getPersister($options['indexName']);
5858

5959
$event = new PrePersistEvent($pager, $objectPersister, $options);
6060
$this->dispatcher->dispatch($event);

Queue/PopulateProcessor.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,12 @@ public function process(Message $message, Context $context): Result
4848
if (!isset($data['options']['indexName'])) {
4949
return Result::reply($this->createReplyMessage($context, $message, 0,'The message is invalid. Missing indexName option.'));
5050
}
51-
if (!isset($data['options']['typeName'])) {
52-
return Result::reply($this->createReplyMessage($context, $message, 0,'The message is invalid. Missing typeName option.'));
53-
}
5451

5552
$options = $data['options'];
5653
$options['first_page'] = $data['page'];
5754
$options['last_page'] = $data['page'];
5855

59-
$provider = $this->pagerProviderRegistry->getProvider($options['indexName'], $options['typeName']);
56+
$provider = $this->pagerProviderRegistry->getProvider($options['indexName']);
6057
$pager = $provider->provide($options);
6158
$pager->setMaxPerPage($options['max_per_page']);
6259
$pager->setCurrentPage($options['first_page']);

0 commit comments

Comments
 (0)