🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@soyuka
Copy link
Contributor

@soyuka soyuka commented Oct 29, 2025

Q A
Branch? 7.4
Bug fix? yes
New feature? no
Deprecations? no
Issues #61357
License MIT

Introduces lazy loading over the recursive mapping behavior of the ObjectMapper.

@symfony symfony deleted a comment from carsonbot Oct 29, 2025
@soyuka soyuka force-pushed the lazy-map branch 6 times, most recently from 56d8df4 to 3624e4f Compare October 30, 2025 06:31
@soyuka soyuka changed the title [ObjectMapper] lazy loading and optional recursion [ObjectMapper] lazy loading Oct 31, 2025
@soyuka soyuka force-pushed the lazy-map branch 3 times, most recently from 33217e5 to 8ddacb3 Compare November 2, 2025 07:25

public function clearObjectMap(): void
{
$this->objectMap = null;
Copy link
Member

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

@soyuka soyuka force-pushed the lazy-map branch 3 times, most recently from 47f3f59 to dfb6950 Compare November 3, 2025 10:36
{
$mapper = new ObjectMapper();
$myMapper = new class($mapper) implements ObjectMapperInterface {
private ?\SplObjectStorage $embededMap = null;
Copy link
Contributor Author

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.

@nicolas-grekas
Copy link
Member

Thank you @soyuka.

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.

3 participants