diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index faccaa57ed5..d110e5a730c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -522,7 +522,6 @@ jobs: - name: Update project dependencies run: | composer update --no-interaction --no-progress --ansi - # composer why doctrine/reflection - name: Require Symfony Uid run: composer require symfony/uid --dev --no-interaction --no-progress --ansi - name: Install PHPUnit diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ce9cb96450..e0bd71c6aeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2.7.0 + +* Doctrine: Better exception to find which resource is linked to an exception (#3965) +* Doctrine: Allow mixed type value for date filter (notice if invalid) (#3870) +* MongoDB: `date_immutable` support (#3940) +* DataProvider: Add `TraversablePaginator` (#3783) +* Swagger UI: Add `swagger_ui_extra_configuration` to Swagger / OpenAPI configuration (#3731) + ## 2.6.3 * Identifiers: Re-allow `POST` operations even if no identifier is defined (#4052) diff --git a/composer.json b/composer.json index a4a2e4fa763..93f236ea7ad 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "doctrine/common": "^2.11 || ^3.0", "doctrine/data-fixtures": "^1.2.2", "doctrine/doctrine-bundle": "^1.12 || ^2.0", - "doctrine/mongodb-odm": "^2.0", + "doctrine/mongodb-odm": "^2.1", "doctrine/mongodb-odm-bundle": "^4.0", "doctrine/orm": "^2.6.4 || ^3.0", "elasticsearch/elasticsearch": "^6.0 || ^7.0", @@ -86,7 +86,7 @@ }, "conflict": { "doctrine/common": "<2.7", - "doctrine/mongodb-odm": "<2.0", + "doctrine/mongodb-odm": "<2.1", "doctrine/persistence": "<1.3" }, "suggest": { diff --git a/docs/adr/0000-subresources-definition.md b/docs/adr/0000-subresources-definition.md index 72cccb17e03..062711279fe 100644 --- a/docs/adr/0000-subresources-definition.md +++ b/docs/adr/0000-subresources-definition.md @@ -1,6 +1,6 @@ # Subresource Definition -* Status: proposed +* Status: superseded by [0002-resource-definition](0002-resource-definition.md)] * Deciders: @dunglas, @vincentchalamon, @soyuka, @GregoireHebert, @Deuchnord ## Context and Problem Statement diff --git a/docs/adr/0002-resource-definition.md b/docs/adr/0002-resource-definition.md new file mode 100644 index 00000000000..7cdfd846950 --- /dev/null +++ b/docs/adr/0002-resource-definition.md @@ -0,0 +1,208 @@ +# Resource definition + +* Status: proposed +* Deciders: @dunglas @soyuka @vincentchalamon @GregoireHebert + +## Context and Problem Statement + +The API Platform `@ApiResource` annotation was initially created to represent a Resource as defined in [Roy Fiedling's dissertation about REST](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_2_1_1) in corelation with [RFC 7231 about HTTP Semantics](https://httpwg.org/specs/rfc7231.html#resources). This annotation brings some confusion as it mixes concepts of resources and operations. Here we discussed how we could revamp API Platform's resource definition using PHP8 attributes, beeing as close as we can to Roy Fiedling's thesis vocabulary. + +## Considered Options + +* Declare multiple ApiResource on a PHP Class [see Subresources definition](./0000-subresources-definition.md) +* Declare operations in conjunction with resources using two attributes: `Resource` and `Operation` +* Use HTTP Verb to represent operations with a syntax sugar for collections (`CGET`?) + +## Decision Outcome + +As Roy Fiedling's thesis states: + +> REST uses a resource identifier to identify the particular resource involved in an interaction between components. REST connectors provide a generic interface for accessing and manipulating the value set of a resource, regardless of how the membership function is defined or the type of software that is handling the request. + +In API Platform, this resource identifier is also named [IRI (Internationalized Resource Identifiers)](https://tools.ietf.org/html/rfc3987). Following these recommandation, applied to PHP, we came up with the following [PHP 8 attributes](https://www.php.net/manual/en/language.attributes.php): + +```php + + + + Code + + + Operations + + + + +
+#[Get]
+class User {}
+            
+ + + + + + + +
+#[GetCollection]
+class User {}
+            
+ + + + + + + +
+#[Get("/users")]
+class User {}
+            
+ + + + + + + +
+#[Post("/users")]
+#[Patch("/users/{id}")]
+class User {}
+            
+ + +