Skip to content

Commit d960a8b

Browse files
authored
chore(ci): fix elasticsearch mapping (#4792)
1 parent ba88c0c commit d960a8b

File tree

8 files changed

+124
-109
lines changed

8 files changed

+124
-109
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,6 @@ jobs:
596596
strategy:
597597
matrix:
598598
php:
599-
- '7.4'
600599
- '8.0'
601600
- '8.1'
602601
fail-fast: false

tests/Fixtures/app/AppKernel.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
111111

112112
$loader->load(__DIR__."/config/config_{$this->getEnvironment()}.yml");
113113

114+
if ('test' === $this->getEnvironment()) {
115+
$loader->load(__DIR__.'/config/config_doctrine.yml');
116+
}
117+
114118
/* @TODO remove this check in 3.0 */
115119
if (\PHP_VERSION_ID >= 70200 && class_exists(Uuid::class) && class_exists(UuidType::class)) {
116120
$loader->load(__DIR__.'/config/config_symfony_uid.yml');
@@ -244,6 +248,7 @@ class_exists(NativePasswordHasher::class) ? 'password_hashers' : 'encoders' => [
244248

245249
$metadataBackwardCompatibilityLayer = (bool) ($_SERVER['METADATA_BACKWARD_COMPATIBILITY_LAYER'] ?? false);
246250
$c->prependExtensionConfig('api_platform', ['metadata_backward_compatibility_layer' => $metadataBackwardCompatibilityLayer]);
251+
247252
if ($metadataBackwardCompatibilityLayer) {
248253
$loader->load(__DIR__.'/config/config_metadata_backward_compatibility_layer.yml');
249254
$c->prependExtensionConfig('api_platform', [
@@ -272,6 +277,11 @@ class_exists(NativePasswordHasher::class) ? 'password_hashers' : 'encoders' => [
272277
}
273278

274279
$loader->load(__DIR__.'/config/config_v3.yml');
280+
281+
if ('elasticsearch' === $this->environment) {
282+
return;
283+
}
284+
275285
$c->prependExtensionConfig('api_platform', [
276286
'mapping' => [
277287
'paths' => ['%kernel.project_dir%/../TestBundle/Resources/config/api_resources_v3'],
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
services:
2+
ApiPlatform\Tests\Fixtures\TestBundle\Doctrine\Orm\EntityManager:
3+
decorates: 'doctrine.orm.default_entity_manager'
4+
arguments:
5+
$wrapped: '@ApiPlatform\Tests\Fixtures\TestBundle\Doctrine\Orm\EntityManager.inner'
6+
$repositoryFactory: '@doctrine.orm.container_repository_factory'
7+
8+
app.my_dummy_resource.search_filter:
9+
parent: 'api_platform.doctrine.orm.search_filter'
10+
arguments: [ { 'id': 'exact', 'name': 'partial', 'alias': 'start', 'description': 'word_start', 'relatedDummy.name': 'exact', 'relatedDummies': 'exact', 'dummy': 'ipartial', 'relatedDummies.name': 'start', 'embeddedDummy.dummyName': 'partial', 'relatedDummy.thirdLevel.level': 'exact', 'relatedDummy.thirdLevel.fourthLevel.level': 'exact', 'relatedDummy.thirdLevel.badFourthLevel.level': 'exact', 'relatedDummy.thirdLevel.fourthLevel.badThirdLevel.level': 'exact', 'nameConverted': 'partial' } ]
11+
tags: [ { name: 'api_platform.filter', id: 'my_dummy.search' } ]
12+
13+
# Tests if the id default to the service name, do not add id attributes here
14+
app.my_dummy_resource.order_filter:
15+
parent: 'api_platform.doctrine.orm.order_filter'
16+
arguments: [ { 'id': ~, 'name': 'desc', 'description': ~, 'relatedDummy.name': ~, 'embeddedDummy.dummyName': 'desc', 'relatedDummy.symfony': ~, 'dummyDate': ~} ]
17+
tags: [ { name: 'api_platform.filter', id: 'my_dummy.order' } ]
18+
19+
app.my_dummy_resource.date_filter:
20+
parent: 'api_platform.doctrine.orm.date_filter'
21+
arguments: [ { 'dummyDate': ~, 'relatedDummy.dummyDate': ~, 'embeddedDummy.dummyDate': ~ } ]
22+
tags: [ { name: 'api_platform.filter', id: 'my_dummy.date' } ]
23+
24+
app.my_dummy_date_resource.date_filter:
25+
parent: 'api_platform.doctrine.orm.date_filter'
26+
arguments: [ { 'dummyDate': ~ } ]
27+
tags: [ { name: 'api_platform.filter', id: 'my_dummy_date.date' } ]
28+
29+
my_dummy_immutable_date.date:
30+
parent: 'api_platform.doctrine.orm.date_filter'
31+
arguments: [ { 'dummyDate': ~ } ]
32+
tags: [ { name: 'api_platform.filter' } ]
33+
34+
app.my_dummy_resource.range_filter:
35+
parent: 'api_platform.doctrine.orm.range_filter'
36+
arguments: [ { 'dummyFloat': ~, 'dummyPrice': ~ } ]
37+
tags: [ { name: 'api_platform.filter', id: 'my_dummy.range' } ]
38+
39+
app.my_dummy_resource.boolean_filter:
40+
parent: 'api_platform.doctrine.orm.boolean_filter'
41+
arguments: [ { 'dummyBoolean': ~, 'embeddedDummy.dummyBoolean': ~, 'relatedDummy.embeddedDummy.dummyBoolean': ~ } ]
42+
tags: [ { name: 'api_platform.filter', id: 'my_dummy.boolean' } ]
43+
44+
app.my_dummy_resource.numeric_filter:
45+
parent: 'api_platform.doctrine.orm.numeric_filter'
46+
arguments: [ { 'dummyFloat': ~, 'dummyPrice': ~ } ]
47+
tags: [ { name: 'api_platform.filter', id: 'my_dummy.numeric' } ]
48+
49+
app.my_dummy_resource.exists_filter:
50+
parent: 'api_platform.doctrine.orm.exists_filter'
51+
arguments: [ { 'alias': ~, 'description': ~, 'relatedDummy.name': ~, 'dummyBoolean': ~, 'relatedDummy': ~, 'relatedDummies': ~ } ]
52+
tags: [ { name: 'api_platform.filter', id: 'my_dummy.exists' } ]
53+
54+
app.related_dummy_resource.search_filter:
55+
parent: 'api_platform.doctrine.orm.search_filter'
56+
arguments: [ { 'relatedToDummyFriend.dummyFriend': 'exact', 'name': 'partial', 'age': 'exact' } ]
57+
tags: [ { name: 'api_platform.filter', id: 'related_dummy.friends' } ]
58+
59+
app.related_dummy_resource.complex_sub_query_filter:
60+
class: ApiPlatform\Tests\Fixtures\TestBundle\Filter\LegacyComplexSubQueryFilter
61+
arguments: ['@doctrine']
62+
tags: [ { name: 'api_platform.filter', id: 'related_dummy.complex_sub_query' } ]
63+
64+
app.related_dummy_to_friend_resource.search_filter:
65+
parent: 'api_platform.doctrine.orm.search_filter'
66+
arguments: [ { 'name': 'ipartial', 'description': 'ipartial' } ]
67+
tags: [ { name: 'api_platform.filter', id: 'related_to_dummy_friend.name' } ]
68+
69+
ApiPlatform\Tests\Fixtures\TestBundle\DataProvider\ProductItemDataProvider:
70+
public: false
71+
arguments:
72+
$managerRegistry: '@doctrine'
73+
tags:
74+
- name: 'api_platform.item_data_provider'
75+
76+
ApiPlatform\Tests\Fixtures\TestBundle\State\ProductProvider:
77+
class: 'ApiPlatform\Tests\Fixtures\TestBundle\State\ProductProvider'
78+
public: false
79+
arguments:
80+
$managerRegistry: '@doctrine'
81+
tags:
82+
- name: 'api_platform.state_provider'
83+
84+
ApiPlatform\Tests\Fixtures\TestBundle\DataProvider\TaxonItemDataProvider:
85+
public: false
86+
arguments:
87+
$managerRegistry: '@doctrine'
88+
tags:
89+
- name: 'api_platform.item_data_provider'
90+
91+
ApiPlatform\Tests\Fixtures\TestBundle\State\TaxonItemProvider:
92+
class: 'ApiPlatform\Tests\Fixtures\TestBundle\State\TaxonItemProvider'
93+
public: false
94+
arguments:
95+
$managerRegistry: '@doctrine'
96+
tags:
97+
- name: 'api_platform.state_provider'
98+
99+
app.dummy_dto_no_input.data_provider:
100+
class: 'ApiPlatform\Tests\Fixtures\TestBundle\DataProvider\DummyDtoNoInputCollectionDataProvider'
101+
public: false
102+
arguments: ['@doctrine']
103+
tags:
104+
- { name: 'api_platform.collection_data_provider' }

tests/Fixtures/app/config/config_elasticsearch.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ api_platform:
1111
elasticsearch:
1212
hosts: '%env(resolve:ELASTICSEARCH_URL)%'
1313

14+
doctrine:
15+
enabled: false
16+
1417
services:
1518
test.api_platform.elasticsearch.client:
1619
parent: api_platform.elasticsearch.client

tests/Fixtures/app/config/config_mysql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
imports:
22
- { resource: config_test.yml }
3+
- { resource: config_doctrine.yml }
34

45
parameters:
56
env(DATABASE_URL): mysql://root:@localhost/api_platform_test

tests/Fixtures/app/config/config_postgres.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
imports:
22
- { resource: config_test.yml }
3+
- { resource: config_doctrine.yml }
34

45
parameters:
56
env(DATABASE_URL): postgres://postgres:@localhost/api_platform_test

tests/Fixtures/app/config/config_sqlite.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
imports:
22
- { resource: config_test.yml }
3+
- { resource: config_doctrine.yml }
34

45
parameters:
56
env(DATABASE_URL): sqlite:///%kernel.project_dir%/var/data.db

tests/Fixtures/app/config/config_test.yml

Lines changed: 4 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -9,122 +9,18 @@ api_platform:
99
- '%kernel.project_dir%/../TestBundle/Model'
1010

1111
services:
12-
ApiPlatform\Tests\Fixtures\TestBundle\Doctrine\Orm\EntityManager:
13-
decorates: 'doctrine.orm.default_entity_manager'
14-
arguments:
15-
$wrapped: '@ApiPlatform\Tests\Fixtures\TestBundle\Doctrine\Orm\EntityManager.inner'
16-
$repositoryFactory: '@doctrine.orm.container_repository_factory'
17-
18-
app.my_dummy_resource.search_filter:
19-
parent: 'api_platform.doctrine.orm.search_filter'
20-
arguments: [ { 'id': 'exact', 'name': 'partial', 'alias': 'start', 'description': 'word_start', 'relatedDummy.name': 'exact', 'relatedDummies': 'exact', 'dummy': 'ipartial', 'relatedDummies.name': 'start', 'embeddedDummy.dummyName': 'partial', 'relatedDummy.thirdLevel.level': 'exact', 'relatedDummy.thirdLevel.fourthLevel.level': 'exact', 'relatedDummy.thirdLevel.badFourthLevel.level': 'exact', 'relatedDummy.thirdLevel.fourthLevel.badThirdLevel.level': 'exact', 'nameConverted': 'partial' } ]
21-
tags: [ { name: 'api_platform.filter', id: 'my_dummy.search' } ]
22-
23-
# Tests if the id default to the service name, do not add id attributes here
24-
app.my_dummy_resource.order_filter:
25-
parent: 'api_platform.doctrine.orm.order_filter'
26-
arguments: [ { 'id': ~, 'name': 'desc', 'description': ~, 'relatedDummy.name': ~, 'embeddedDummy.dummyName': 'desc', 'relatedDummy.symfony': ~, 'dummyDate': ~} ]
27-
tags: [ { name: 'api_platform.filter', id: 'my_dummy.order' } ]
28-
29-
app.my_dummy_resource.date_filter:
30-
parent: 'api_platform.doctrine.orm.date_filter'
31-
arguments: [ { 'dummyDate': ~, 'relatedDummy.dummyDate': ~, 'embeddedDummy.dummyDate': ~ } ]
32-
tags: [ { name: 'api_platform.filter', id: 'my_dummy.date' } ]
33-
34-
app.my_dummy_date_resource.date_filter:
35-
parent: 'api_platform.doctrine.orm.date_filter'
36-
arguments: [ { 'dummyDate': ~ } ]
37-
tags: [ { name: 'api_platform.filter', id: 'my_dummy_date.date' } ]
38-
39-
my_dummy_immutable_date.date:
40-
parent: 'api_platform.doctrine.orm.date_filter'
41-
arguments: [ { 'dummyDate': ~ } ]
42-
tags: [ { name: 'api_platform.filter' } ]
43-
44-
app.my_dummy_resource.range_filter:
45-
parent: 'api_platform.doctrine.orm.range_filter'
46-
arguments: [ { 'dummyFloat': ~, 'dummyPrice': ~ } ]
47-
tags: [ { name: 'api_platform.filter', id: 'my_dummy.range' } ]
48-
49-
app.my_dummy_resource.boolean_filter:
50-
parent: 'api_platform.doctrine.orm.boolean_filter'
51-
arguments: [ { 'dummyBoolean': ~, 'embeddedDummy.dummyBoolean': ~, 'relatedDummy.embeddedDummy.dummyBoolean': ~ } ]
52-
tags: [ { name: 'api_platform.filter', id: 'my_dummy.boolean' } ]
53-
54-
app.my_dummy_resource.numeric_filter:
55-
parent: 'api_platform.doctrine.orm.numeric_filter'
56-
arguments: [ { 'dummyFloat': ~, 'dummyPrice': ~ } ]
57-
tags: [ { name: 'api_platform.filter', id: 'my_dummy.numeric' } ]
58-
59-
app.my_dummy_resource.exists_filter:
60-
parent: 'api_platform.doctrine.orm.exists_filter'
61-
arguments: [ { 'alias': ~, 'description': ~, 'relatedDummy.name': ~, 'dummyBoolean': ~, 'relatedDummy': ~, 'relatedDummies': ~ } ]
62-
tags: [ { name: 'api_platform.filter', id: 'my_dummy.exists' } ]
63-
64-
app.related_dummy_resource.search_filter:
65-
parent: 'api_platform.doctrine.orm.search_filter'
66-
arguments: [ { 'relatedToDummyFriend.dummyFriend': 'exact', 'name': 'partial', 'age': 'exact' } ]
67-
tags: [ { name: 'api_platform.filter', id: 'related_dummy.friends' } ]
68-
69-
app.related_dummy_resource.complex_sub_query_filter:
70-
class: ApiPlatform\Tests\Fixtures\TestBundle\Filter\LegacyComplexSubQueryFilter
12+
app.dummy_dto_no_output_data_persister:
13+
class: ApiPlatform\Tests\Fixtures\TestBundle\DataPersister\DummyDtoNoOutputDataPersister
7114
arguments: ['@doctrine']
72-
tags: [ { name: 'api_platform.filter', id: 'related_dummy.complex_sub_query' } ]
73-
74-
app.related_dummy_to_friend_resource.search_filter:
75-
parent: 'api_platform.doctrine.orm.search_filter'
76-
arguments: [ { 'name': 'ipartial', 'description': 'ipartial' } ]
77-
tags: [ { name: 'api_platform.filter', id: 'related_to_dummy_friend.name' } ]
78-
79-
ApiPlatform\Tests\Fixtures\TestBundle\DataProvider\GeneratorDataProvider:
80-
public: false
81-
tags:
82-
- name: 'api_platform.item_data_provider'
83-
84-
ApiPlatform\Tests\Fixtures\TestBundle\DataProvider\ProductItemDataProvider:
8515
public: false
86-
arguments:
87-
$managerRegistry: '@doctrine'
8816
tags:
89-
- name: 'api_platform.item_data_provider'
90-
91-
ApiPlatform\Tests\Fixtures\TestBundle\State\ProductProvider:
92-
class: 'ApiPlatform\Tests\Fixtures\TestBundle\State\ProductProvider'
93-
public: false
94-
arguments:
95-
$managerRegistry: '@doctrine'
96-
tags:
97-
- name: 'api_platform.state_provider'
17+
- { name: 'api_platform.data_persister' }
9818

99-
ApiPlatform\Tests\Fixtures\TestBundle\DataProvider\TaxonItemDataProvider:
19+
ApiPlatform\Tests\Fixtures\TestBundle\DataProvider\GeneratorDataProvider:
10020
public: false
101-
arguments:
102-
$managerRegistry: '@doctrine'
10321
tags:
10422
- name: 'api_platform.item_data_provider'
10523

106-
ApiPlatform\Tests\Fixtures\TestBundle\State\TaxonItemProvider:
107-
class: 'ApiPlatform\Tests\Fixtures\TestBundle\State\TaxonItemProvider'
108-
public: false
109-
arguments:
110-
$managerRegistry: '@doctrine'
111-
tags:
112-
- name: 'api_platform.state_provider'
113-
114-
app.dummy_dto_no_input.data_provider:
115-
class: 'ApiPlatform\Tests\Fixtures\TestBundle\DataProvider\DummyDtoNoInputCollectionDataProvider'
116-
public: false
117-
arguments: ['@doctrine']
118-
tags:
119-
- { name: 'api_platform.collection_data_provider' }
120-
121-
app.dummy_dto_no_output_data_persister:
122-
class: ApiPlatform\Tests\Fixtures\TestBundle\DataPersister\DummyDtoNoOutputDataPersister
123-
arguments: ['@doctrine']
124-
public: false
125-
tags:
126-
- { name: 'api_platform.data_persister' }
127-
12824
app.user_reset_password_data_persister:
12925
class: ApiPlatform\Tests\Fixtures\TestBundle\DataPersister\UserResetPasswordDataPersister
13026
public: false

0 commit comments

Comments
 (0)