-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[ObjectMapper] lazy loading #62214
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
[ObjectMapper] lazy loading #62214
Conversation
56d8df4 to
3624e4f
Compare
33217e5 to
8ddacb3
Compare
|
|
||
| public function clearObjectMap(): void | ||
| { | ||
| $this->objectMap = null; |
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.
would replacing the SplObjectStorage by a WeakMap solve this concern?
also: this looks like a reset() method - we might not need a new interface: ResetInterface FTW - if we still need this
src/Symfony/Component/ObjectMapper/Tests/Fixtures/DefaultLazy/OrderSource.php
Outdated
Show resolved
Hide resolved
47f3f59 to
dfb6950
Compare
| { | ||
| $mapper = new ObjectMapper(); | ||
| $myMapper = new class($mapper) implements ObjectMapperInterface { | ||
| private ?\SplObjectStorage $embededMap = null; |
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.
This test got transformed and now only tests that an embeded relation does call the decorated mapper.
The previous test (based on api-platform/core@d06b1a0) was based on a leaking object map which isn't great (thanks @nicolas-grekas for the fix). The new non-leaky behavior will need an update for our particular use case inside API Platform and that's fine.
|
Thank you @soyuka. |
71c6a60 to
83f086d
Compare
Introduces lazy loading over the recursive mapping behavior of the ObjectMapper.