Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(symfony): Fix some errors on Symfony support with Elastica 8 #199

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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