Skip to content

Initialize nullable promoted file properties on load - #1602

Draft
tomatotomata wants to merge 3 commits into
dustin10:masterfrom
tomatotomata:codex/nullable-promoted-upload-field-1411
Draft

Initialize nullable promoted file properties on load#1602
tomatotomata wants to merge 3 commits into
dustin10:masterfrom
tomatotomata:codex/nullable-promoted-upload-field-1411

Conversation

@tomatotomata

Copy link
Copy Markdown

Fixes #1411

When a nullable uploadable field is constructor-promoted, Doctrine can hydrate the entity without running its constructor. If no stored filename exists, the injector previously skipped the setter, leaving the promoted property uninitialized and causing an UninitializedPropertyException on access.

This change explicitly writes null on the no-path branch and allows PropertyMapping::setFile() to accept nullable files. The regression test exercises an instance created without its constructor and verifies the getter returns null after injection.

Verification:

  • git diff --check passed
  • PHPUnit could not be run because Docker Desktop's Linux engine is unavailable in this environment

The scope follows the solution proposed by the issue reporter and the collaborator response there: #1411 (comment)

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.

UnitializedPropertyException when using nullable UploadableField as promoted property

1 participant