Skip to content

Commit cf65af3

Browse files
authored
Merge pull request #2819 from teohhanhui/merge-2.4
Merge 2.4 into master
2 parents 82363f3 + ae610c7 commit cf65af3

File tree

130 files changed

+4192
-1956
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+4192
-1956
lines changed

.circleci/config.yml

Lines changed: 466 additions & 210 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
/.php_cs.cache
21
/.php_cs
3-
/composer.phar
2+
/.php_cs.cache
3+
/build/
44
/composer.lock
5+
/composer.phar
56
/phpunit.xml
6-
/vendor/
7-
/tests/Fixtures/app/var/*
8-
/tests/Fixtures/app/cache/*
9-
/tests/Fixtures/app/logs/*
107
/swagger.json
118
/swagger.yaml
9+
/tests/Fixtures/app/var/
10+
/vendor/

.php_cs.dist

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ HEADER;
1313

1414
$finder = PhpCsFixer\Finder::create()
1515
->in(__DIR__)
16-
->exclude('tests/Fixtures/app/var');
16+
->exclude('tests/Fixtures/app/var')
17+
->append([
18+
'tests/Fixtures/app/console',
19+
]);
1720

1821
return PhpCsFixer\Config::create()
1922
->setRiskyAllowed(true)

.travis.yml

Lines changed: 195 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,78 +5,222 @@ cache:
55
- $HOME/.composer/cache
66
- $HOME/.npm
77

8+
.steps:
9+
- &add-composer-bin-dir-to-path |
10+
export PATH="$PATH:$HOME/.composer/vendor/bin"
11+
- &clear-test-app-cache |
12+
tests/Fixtures/app/console cache:clear
13+
- &disable-php-memory-limit |
14+
echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
15+
- &disable-xdebug-php-extension |
16+
phpenv config-rm xdebug.ini || echo "xdebug not available"
17+
- &install-doctrine-mongodb-odm |
18+
composer require --prefer-dist --no-progress --no-suggest --no-update --ansi \
19+
doctrine/mongodb-odm:^2.0@beta \
20+
doctrine/mongodb-odm-bundle:^4.0@beta \
21+
- &install-mongodb-php-extension |
22+
echo "extension=mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/mongodb.ini
23+
- &run-behat-tests |
24+
vendor/bin/behat --format=progress --no-interaction
25+
- &run-phpunit-tests |
26+
vendor/bin/phpunit
27+
- &update-project-dependencies |
28+
composer update --prefer-dist --no-progress --no-suggest --ansi
29+
- &validate-openapi-v2-json |
30+
tests/Fixtures/app/console api:swagger:export > swagger.json && npx swagger-cli validate swagger.json && rm swagger.json
31+
- &validate-openapi-v2-yaml |
32+
tests/Fixtures/app/console api:swagger:export --yaml > swagger.yaml && npx swagger-cli validate swagger.yaml && rm swagger.yaml
33+
- &validate-openapi-v3-json |
34+
tests/Fixtures/app/console api:openapi:export --spec-version 3 > swagger.json && npx swagger-cli validate swagger.json && rm swagger.json
35+
- &validate-openapi-v3-yaml |
36+
tests/Fixtures/app/console api:openapi:export --spec-version 3 --yaml > swagger.yaml && npx swagger-cli validate swagger.yaml && rm swagger.yaml
37+
838
jobs:
939
include:
1040
- php: '7.1'
11-
env: NO_UNIT_TESTS=true
1241
before_install:
13-
- composer remove --dev ext-mongodb doctrine/mongodb-odm doctrine/mongodb-odm-bundle
14-
- sed -i '33,39d' tests/Fixtures/app/config/config_common.yml
42+
- *disable-php-memory-limit
43+
- *disable-xdebug-php-extension
44+
- *add-composer-bin-dir-to-path
45+
install:
46+
- *update-project-dependencies
47+
before_script:
48+
- *clear-test-app-cache
49+
script:
50+
- *run-phpunit-tests
51+
- *clear-test-app-cache
52+
- *run-behat-tests
53+
- *validate-openapi-v2-json
54+
- *validate-openapi-v2-yaml
55+
- *validate-openapi-v3-json
56+
- *validate-openapi-v3-yaml
57+
1558
- php: '7.2'
59+
before_install:
60+
- *disable-php-memory-limit
61+
- *disable-xdebug-php-extension
62+
- *add-composer-bin-dir-to-path
63+
install:
64+
- *update-project-dependencies
65+
before_script:
66+
- *clear-test-app-cache
67+
script:
68+
- *run-phpunit-tests
69+
- *clear-test-app-cache
70+
- *run-behat-tests
71+
- *validate-openapi-v2-json
72+
- *validate-openapi-v2-yaml
73+
- *validate-openapi-v3-json
74+
- *validate-openapi-v3-yaml
75+
1676
- php: '7.3'
77+
before_install:
78+
- *disable-php-memory-limit
79+
- *disable-xdebug-php-extension
80+
- *add-composer-bin-dir-to-path
81+
install:
82+
- *update-project-dependencies
83+
before_script:
84+
- *clear-test-app-cache
85+
script:
86+
- *run-phpunit-tests
87+
- *clear-test-app-cache
88+
- *run-behat-tests
89+
- *validate-openapi-v2-json
90+
- *validate-openapi-v2-yaml
91+
- *validate-openapi-v3-json
92+
- *validate-openapi-v3-yaml
93+
1794
- php: '7.3'
1895
env: deps=low
96+
before_install:
97+
- *disable-php-memory-limit
98+
- *disable-xdebug-php-extension
99+
- *add-composer-bin-dir-to-path
100+
install:
101+
- composer update --prefer-dist --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi
102+
before_script:
103+
- *clear-test-app-cache
104+
script:
105+
- *run-phpunit-tests
106+
- *clear-test-app-cache
107+
- *run-behat-tests
108+
- *validate-openapi-v2-json
109+
- *validate-openapi-v2-yaml
110+
- *validate-openapi-v3-json
111+
- *validate-openapi-v3-yaml
112+
19113
- php: '7.3'
20-
env: SYMFONY_DEPRECATIONS_HELPER=0
21-
- php: '7.3'
114+
env: APP_ENV=postgres
22115
services:
23116
- postgresql
117+
before_install:
118+
- *disable-php-memory-limit
119+
- *disable-xdebug-php-extension
120+
- *add-composer-bin-dir-to-path
121+
install:
122+
- *update-project-dependencies
24123
before_script:
25-
- psql -c 'create database api_platform_test;' -U postgres
26-
env: APP_ENV=postgres
124+
- *clear-test-app-cache
125+
- psql --command 'CREATE DATABASE api_platform_test;' --username postgres
126+
script:
127+
- *run-phpunit-tests
128+
- *clear-test-app-cache
129+
- vendor/bin/behat --format=progress --profile=postgres --no-interaction
130+
- *validate-openapi-v2-json
131+
- *validate-openapi-v2-yaml
132+
- *validate-openapi-v3-json
133+
- *validate-openapi-v3-yaml
134+
27135
- php: '7.3'
136+
env: APP_ENV=mysql
28137
services:
29138
- mysql
139+
before_install:
140+
- *disable-php-memory-limit
141+
- *disable-xdebug-php-extension
142+
- *add-composer-bin-dir-to-path
143+
install:
144+
- *update-project-dependencies
30145
before_script:
31-
- mysql -e 'CREATE DATABASE api_platform_test;'
32-
env: APP_ENV=mysql
146+
- *clear-test-app-cache
147+
- mysql --execute 'CREATE DATABASE api_platform_test;'
148+
script:
149+
- *run-phpunit-tests
150+
- *clear-test-app-cache
151+
- *run-behat-tests
152+
- *validate-openapi-v2-json
153+
- *validate-openapi-v2-yaml
154+
- *validate-openapi-v3-json
155+
- *validate-openapi-v3-yaml
156+
33157
- php: '7.3'
158+
env: APP_ENV=mongodb
34159
services:
35160
- mongodb
36-
env: APP_ENV=mongodb
161+
before_install:
162+
- *disable-php-memory-limit
163+
- *install-mongodb-php-extension
164+
- *disable-xdebug-php-extension
165+
- *add-composer-bin-dir-to-path
166+
install:
167+
- *install-doctrine-mongodb-odm
168+
- *update-project-dependencies
169+
before_script:
170+
- *clear-test-app-cache
171+
script:
172+
- vendor/bin/phpunit --configuration phpunit_mongodb.xml
173+
- *clear-test-app-cache
174+
- vendor/bin/behat --format=progress --profile=mongodb --no-interaction
175+
- *validate-openapi-v2-json
176+
- *validate-openapi-v2-yaml
177+
- *validate-openapi-v3-json
178+
- *validate-openapi-v3-yaml
179+
37180
- php: '7.3'
38-
services:
39-
- elasticsearch
40181
env: APP_ENV=elasticsearch
182+
before_install:
183+
- sudo apt-get purge --auto-remove elasticsearch
184+
- wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
185+
- echo 'deb https://artifacts.elastic.co/packages/6.x/apt stable main' | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
186+
- sudo apt-get update
187+
- sudo apt-get install elasticsearch
188+
- sudo service elasticsearch start
189+
- *disable-php-memory-limit
190+
- *disable-xdebug-php-extension
191+
- *add-composer-bin-dir-to-path
192+
install:
193+
- *update-project-dependencies
194+
before_script:
195+
- *clear-test-app-cache
196+
script:
197+
- *run-phpunit-tests
198+
- *clear-test-app-cache
199+
- vendor/bin/behat --format=progress --profile=elasticsearch --no-interaction
200+
- *validate-openapi-v2-json
201+
- *validate-openapi-v2-yaml
202+
- *validate-openapi-v3-json
203+
- *validate-openapi-v3-yaml
204+
205+
- php: '7.3'
206+
env: SYMFONY_DEPRECATIONS_HELPER=0
207+
before_install:
208+
- *disable-php-memory-limit
209+
- *disable-xdebug-php-extension
210+
- *add-composer-bin-dir-to-path
211+
install:
212+
- *update-project-dependencies
213+
before_script:
214+
- *clear-test-app-cache
215+
script:
216+
- *run-phpunit-tests
217+
- *clear-test-app-cache
218+
- *run-behat-tests
219+
- *validate-openapi-v2-json
220+
- *validate-openapi-v2-yaml
221+
- *validate-openapi-v3-json
222+
- *validate-openapi-v3-yaml
223+
41224
allow_failures:
42225
- env: SYMFONY_DEPRECATIONS_HELPER=0
43226
fast_finish: true
44-
45-
before_install:
46-
- if [[ $APP_ENV = 'elasticsearch' ]]; then
47-
curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.0.deb && sudo dpkg -i --force-confnew elasticsearch-6.5.0.deb && sudo service elasticsearch restart;
48-
fi
49-
- phpenv config-rm xdebug.ini || echo "xdebug not available"
50-
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
51-
- echo "extension=mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
52-
- export PATH="$PATH:$HOME/.composer/vendor/bin"
53-
54-
install:
55-
- if [[ $deps = 'low' ]]; then
56-
composer update --prefer-dist --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi;
57-
else
58-
composer update --prefer-dist --no-progress --no-suggest --ansi;
59-
fi
60-
61-
script:
62-
- tests/Fixtures/app/console cache:clear
63-
- if [[ $NO_UNIT_TESTS != true ]]; then
64-
vendor/bin/phpunit;
65-
fi
66-
- if [[ $APP_ENV = 'mongodb' ]]; then
67-
vendor/bin/phpunit -c phpunit.mongo.xml;
68-
fi
69-
- tests/Fixtures/app/console cache:clear
70-
- if [[ $APP_ENV = 'postgres' ]]; then
71-
vendor/bin/behat --suite=postgres --format=progress --no-interaction;
72-
elif [[ $APP_ENV = 'mongodb' ]]; then
73-
vendor/bin/behat --suite=mongodb --format=progress --no-interaction;
74-
elif [[ $APP_ENV = 'elasticsearch' ]]; then
75-
vendor/bin/behat --suite=elasticsearch --format=progress --no-interaction;
76-
else
77-
vendor/bin/behat --suite=default --format=progress --no-interaction;
78-
fi
79-
- tests/Fixtures/app/console api:swagger:export > swagger.json && npx swagger-cli validate swagger.json && rm swagger.json
80-
- tests/Fixtures/app/console api:swagger:export --yaml > swagger.yaml && npx swagger-cli validate swagger.yaml && rm swagger.yaml
81-
- tests/Fixtures/app/console api:openapi:export --spec-version 3 > swagger.json && npx swagger-cli validate swagger.json && rm swagger.json
82-
- tests/Fixtures/app/console api:openapi:export --spec-version 3 --yaml > swagger.yaml && npx swagger-cli validate swagger.yaml && rm swagger.yaml

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,61 @@
44

55
* GraphQL: Add support for custom types
66

7+
## 2.4.3
8+
9+
* Doctrine: allow autowiring of filter classes
10+
* Doctrine: don't use `fetchJoinCollection` on `Paginator` when not needed
11+
* Doctrine: fix a BC break in `OrderFilter`
12+
* GraphQL: input objects aren't nullable anymore (compliance with the Relay spec)
13+
* Cache: Remove some useless purges
14+
* Mercure: publish to Mercure using the default response format
15+
* Mercure: use the Serializer context
16+
* OpenAPI: fix documentation of the `PropertyFilter`
17+
* OpenAPI: fix generation of the `servers` block (also fixes the compatibility with Postman)
18+
* OpenAPI: skip not readable and not writable properties from the spec
19+
* OpenAPI: add the `id` path parameter for POST item operation
20+
* Serializer: add support for Symfony Serializer's `@SerializedName` metadata
21+
* Metadata: `ApiResource`'s `attributes` property now defaults to `null`, as expected
22+
* Metadata: Fix identifier support when using an interface as resource class
23+
* Metadata: the HTTP method is now always uppercased
24+
* Allow to disable listeners per operation (fix handling of empty request content)
25+
26+
Previously, empty request content was allowed for any `POST` and `PUT` operations. This was an unsafe assumption which caused [other problems](https://github.com/api-platform/core/issues/2731).
27+
28+
If you wish to allow empty request content, please add `"deserialize"=false` to the operation's attributes. For example:
29+
30+
```php
31+
<?php
32+
// api/src/Entity/Book.php
33+
34+
use ApiPlatform\Core\Annotation\ApiResource;
35+
use App\Controller\PublishBookAction;
36+
37+
/**
38+
* @ApiResource(
39+
* itemOperations={
40+
* "put_publish"={
41+
* "method"="PUT",
42+
* "path"="/books/{id}/publish",
43+
* "controller"=PublishBookAction::class,
44+
* "deserialize"=false,
45+
* },
46+
* },
47+
* )
48+
*/
49+
class Book
50+
{
51+
```
52+
53+
You may also need to add `"validate"=false` if the controller result is `null` (possibly because you don't need to persist the resource).
54+
55+
* Return the `204` HTTP status code when the output class is set to `null`
56+
* Be more resilient when normalizing non-resource objects
57+
* Replace the `data` request attribute by the return of the data persister
58+
* Fix error message in identifiers extractor
59+
* Improve the bundle's default configuration when using `symfony/symfony` is required
60+
* Fix the use of `MetadataAwareNameConverter` when available (configuring `name_converter: serializer.name_converter.metadata_aware` will now result in a circular reference error)
61+
762
## 2.4.2
863

964
* Fix a dependency injection injection problem in `FilterEagerLoadingExtension`

0 commit comments

Comments
 (0)