Skip to content

Merge 2.5 #3571

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

Merged
merged 41 commits into from
May 29, 2020
Merged

Merge 2.5 #3571

merged 41 commits into from
May 29, 2020

Conversation

alanpoulain
Copy link
Member

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

silverbackdan and others added 30 commits April 20, 2020 13:38
In `ApiPlatform\Core\DataTransformer\DataTransformerInterface` there is a comment that states that DTOs should be allowed to return the same original object if no transformation is done. This resulted in missing LD data. (No @id, @context etc.).
```php
     /**
     * Transforms the given object to something else, usually another object.
     * This must return the original object if no transformation has been done.
     *
     * @param object $object
     *
     * @return object
     */
    public function transform($object, string $to, array $context = []);
```
This update checks if the output class is the same as the original, and if so populated the extended metadata in the JsonLd\ItemNormalizer as it would not be added using the JsonLd\ObjectNormalizer
When a DataTransformer returns the original resource as a fallback, a context key is set so when repeating the serialization/normalization we can populate the extended jsonld data
Previous push reverted a change which is beneficial to performance. Instead of re-looping over the serializer/normalizers, if the DTO output class is defined as the same as the resource, we can detect this in the 1st round of serialization
…set no matter how the same class/object is returned
- Prevent BC change on AbstractItemNormalizer::transformOutput
- Remove useless documentation
`src/Serializer/AbstractItemNormalizer.php`: Update constant name
Change author phpdoc on test documents and entities
Revert "Passing custom doctrine type to addWhereByStrategy"
…put-class-same-as-original

Bug Fix: DataTransformer returning same class as original should include JSONLD Data
* Fix: Allow objects without properties

* Refactor tests

Co-authored-by: Andreas Möller <[email protected]>

* Fix: CS

* Add testcases

Co-authored-by: Andreas Möller <[email protected]>
@alanpoulain alanpoulain force-pushed the merge-2.5 branch 2 times, most recently from 01a3d4a to 249a222 Compare May 28, 2020 22:03
@alanpoulain alanpoulain merged commit beb03a6 into api-platform:master May 29, 2020
@alanpoulain alanpoulain deleted the merge-2.5 branch May 29, 2020 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants