Skip to content

Commit

Permalink
fix(symfony): Fix some errors on Symfony support with Elastica 8 (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
damienalexandre authored Nov 21, 2024
1 parent c4bd889 commit ef0cb9b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ elastically:
connections:
default:
client:
host: '%env(ELASTICSEARCH_HOST)%'
hosts:
- '127.0.0.1:9200'
# Path to the mapping directory (in YAML)
mapping_directory: '%kernel.project_dir%/config/elasticsearch'
Expand Down Expand Up @@ -337,7 +338,8 @@ JoliCode\Elastically\Transport\HttpClientTransport: ~
JoliCode\Elastically\Client:
arguments:
$config:
host: '%env(ELASTICSEARCH_HOST)%'
hosts:
- '127.0.0.1:9200'
transport_client:
client: '@my_custom_psr18_client' # An instance of Symfony\Component\HttpClient\Psr18Client (Or any PSR 18 compliant one)
```
Expand Down
1 change: 0 additions & 1 deletion src/Bridge/Symfony/Resources/config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
->abstract()
->args([
'$config' => abstract_arg('config'),
'$callback' => null,
'$logger' => service('logger')->nullOnInvalid(),
'$resultSetBuilder' => abstract_arg('elastically.abstract.result_set_builder'),
'$indexNameMapper' => abstract_arg('elastically.abstract.index_name_mapper'),
Expand Down
2 changes: 2 additions & 0 deletions tests/Symfony/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace JoliCode\Elastically\Tests\Symfony;

use JoliCode\Elastically\Bridge\Symfony\ElasticallyBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
Expand All @@ -28,6 +29,7 @@ public function registerBundles(): iterable
{
return [
new FrameworkBundle(),
new ElasticallyBundle(),
];
}

Expand Down
26 changes: 15 additions & 11 deletions tests/Symfony/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ framework:
elasticsearch.client:
base_uri: 'http://localhost:9999'

elastically:
connections:
default:
client:
hosts:
- 'localhost:9999'
mapping_directory: '%kernel.project_dir%/configs_analysis'

# Size of the bulk sent to Elasticsearch (default to 100)
bulk_size: 100

# Mapping between an index name and a FQCN
index_class_mapping:
hop: JoliCode\Elastically\Tests\Messenger\TestDTO

services:
_defaults:
public: true
Expand All @@ -45,17 +60,6 @@ services:
arguments:
$client: '@elasticsearch.client'

JoliCode\Elastically\Client:
arguments:
$config:
host: 'localhost'
port: '9999'
elastically_mappings_directory: '%kernel.project_dir%/configs_analysis'
elastically_index_class_mapping:
hop: JoliCode\Elastically\Tests\Messenger\TestDTO
elastically_bulk_size: 100
$logger: '@logger'

JoliCode\Elastically\Messenger\IndexationRequestSpoolSubscriber:
arguments:
- '@messenger.transport.queuing'
Expand Down

0 comments on commit ef0cb9b

Please sign in to comment.