-
-
Notifications
You must be signed in to change notification settings - Fork 381
[LiveComponent] Add support for interfaces while (de)hydrating a Doctrine entity #2834
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
base: 2.x
Are you sure you want to change the base?
Conversation
…iased to an entity Doctrine have the feature to use interface aliased to a concrete entity class. This PR propose a small modification to ensure that is will also supported by the doctrine hydrator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your first contribution :)
src/LiveComponent/src/Hydration/DoctrineEntityHydrationExtension.php
Outdated
Show resolved
Hide resolved
src/LiveComponent/src/Hydration/DoctrineEntityHydrationExtension.php
Outdated
Show resolved
Hide resolved
src/LiveComponent/src/Hydration/DoctrineEntityHydrationExtension.php
Outdated
Show resolved
Hide resolved
Making tests
The last commit provides some tests. |
src/LiveComponent/tests/Integration/Hydration/DoctrineEntityHydrationExtensionTest.php
Outdated
Show resolved
Hide resolved
src/LiveComponent/tests/Integration/Hydration/DoctrineEntityHydrationExtensionTest.php
Outdated
Show resolved
Hide resolved
src/LiveComponent/tests/Fixtures/Entity/AliasedEntityInterface.php
Outdated
Show resolved
Hide resolved
src/LiveComponent/src/Hydration/DoctrineEntityHydrationExtension.php
Outdated
Show resolved
Hide resolved
src/LiveComponent/src/Hydration/DoctrineEntityHydrationExtension.php
Outdated
Show resolved
Hide resolved
src/LiveComponent/src/Hydration/DoctrineEntityHydrationExtension.php
Outdated
Show resolved
Hide resolved
src/LiveComponent/src/Hydration/DoctrineEntityHydrationExtension.php
Outdated
Show resolved
Hide resolved
// special handler for interfaces | ||
// For use cases : @see https://symfony.com/doc/current/doctrine/resolve_target_entity.html | ||
// As today, getManagerForClass don't resolve nicely aliased interfaces | ||
// The workaround is to enum over each object manager and trying to get metadata | ||
// The metadata are indeed, resolved nicely | ||
// Fore more details : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we turn this into two or three lines, insisting more on what we "do" than on what "was" the problem ?
Co-authored-by: Simon André <[email protected]>
…drationExtensionTest.php Co-authored-by: Simon André <[email protected]>
…drationExtensionTest.php Co-authored-by: Simon André <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review !
Thanks for the review ! Co-authored-by: Simon André <[email protected]>
Doctrine have the feature to use interface aliased to a concrete entity class.
This PR propose a small modification to ensure that is will also supported by the doctrine hydrator