Skip to content

fix(doctrine): skip uninitialized properties in handleLazyObjectRelations#7738

Merged
soyuka merged 1 commit intoapi-platform:4.2from
marius-swfy:fix/persist-processor-uninitialized-properties
Feb 6, 2026
Merged

fix(doctrine): skip uninitialized properties in handleLazyObjectRelations#7738
soyuka merged 1 commit intoapi-platform:4.2from
marius-swfy:fix/persist-processor-uninitialized-properties

Conversation

@marius-swfy
Copy link

Summary

  • Add isInitialized() check before ReflectionProperty::getValue() in PersistProcessor::handleLazyObjectRelations() to prevent fatal errors on typed properties that are only set during Doctrine @PrePersist lifecycle callbacks.
  • Since the method's purpose is to find lazy-loaded object relations, skipping uninitialized properties is safe — they cannot contain a lazy proxy object.

Test plan

  • Added DummyWithUninitializedProperties fixture entity with typed properties without defaults
  • Added testHandleLazyObjectRelationsSkipsUninitializedProperties test using Post(map: true) to exercise the canMap() code path with uninitialized typed properties
  • All existing PersistProcessor tests continue to pass

Closes #7735

🤖 Generated with Claude Code

…ions

Add an isInitialized() check before accessing property values in
PersistProcessor::handleLazyObjectRelations() to prevent fatal errors
on typed properties that are set during Doctrine @PrePersist lifecycle
callbacks.

Closes api-platform#7735

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@soyuka soyuka merged commit 4f307d3 into api-platform:4.2 Feb 6, 2026
129 of 130 checks passed
@soyuka
Copy link
Member

soyuka commented Feb 6, 2026

Nice thanks!

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.

3 participants