Skip to content

Fix the denormalization of \DateTime(Immutable) for ES documents#3981

Merged
soyuka merged 2 commits into
api-platform:mainfrom
meyerbaptiste:fix_3908_3170
Apr 26, 2021
Merged

Fix the denormalization of \DateTime(Immutable) for ES documents#3981
soyuka merged 2 commits into
api-platform:mainfrom
meyerbaptiste:fix_3908_3170

Conversation

@meyerbaptiste

@meyerbaptiste meyerbaptiste commented Jan 25, 2021

Copy link
Copy Markdown
Member
Q A
Bug fix? yes
New feature? no
BC breaks? yes
Deprecations? no
Tickets fixes #3908 fixes #3170
License MIT
Doc PR n/A

This PR:

  • Reverts the priority of the Elasticsearch documents normalizer from -890 to -922.
  • Introduces an item normalizer decorator that prevents the default ApiPlatform\Core\Serializer\ItemNormalizer from taking over for the elasticsearch format because of priorities when the bridge is enabled.
  • Renames the ApiPlatform\Core\Bridge\Elasticsearch\Serializer\ItemNormalizer class to ApiPlatform\Core\Bridge\Elasticsearch\Serializer\DocumentNormalizer so that the role of the denormalizer is more explicit: to transform Elasticsearch documents into PHP objects. This is a BC break however the class is marked as experimental. Because of this, it might be better to apply this fix to 3.0.

@soyuka

soyuka commented Jan 26, 2021

Copy link
Copy Markdown
Member

@dunglas can we consider this as a bug fix?

@dunglas

dunglas commented Jan 26, 2021

Copy link
Copy Markdown
Member

I don't think so. We must stop introducing such heavy changes in patch release imho.

@meyerbaptiste meyerbaptiste force-pushed the fix_3908_3170 branch 3 times, most recently from 3bb178c to 1adc176 Compare January 26, 2021 10:42
Comment thread tests/Fixtures/Elasticsearch/Model/Tweet.php
@meyerbaptiste meyerbaptiste force-pushed the fix_3908_3170 branch 2 times, most recently from 4d61f08 to 367fa10 Compare February 2, 2021 11:30
@soyuka soyuka added this to the 2.7 milestone Feb 6, 2021
@soyuka soyuka merged commit 35b022f into api-platform:main Apr 26, 2021
@soyuka

soyuka commented Apr 26, 2021

Copy link
Copy Markdown
Member

thanks @meyerbaptiste

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ES] Normalization \DateTimeImmutable throws MissingConstructorArgumentsException [BUG] DateTime denormalization fails with elasticsearch provider

3 participants