Skip to content

fix(metadata): Put::withAllowCreate() and Link::withFromProperty() return a new instance - #8685

Merged
soyuka merged 4 commits into
api-platform:5.0from
Maxcastel:fix/metadata-withers-immutability
Oct 16, 2026
Merged

soyuka merged 4 commits into
api-platform:5.0from
Maxcastel:fix/metadata-withers-immutability

Conversation

@Maxcastel

Copy link
Copy Markdown
Contributor
Q A
Branch? 5.0
Tickets
License MIT
Doc PR

Put::withAllowCreate() returned void and changed the operation itself. With 'defaults' => ['allow_create' => true] in the Laravel config, building the metadata fails:

Error: Call to a member function withExtraProperties() on null

Link::withFromProperty() forgot the clone too.

Tests: testCreateWithAllowCreateDefault, and a new WithersTest that calls every with*() method of the metadata classes and checks it returns a new instance (these two were the only ones failing).

@Maxcastel
Maxcastel changed the base branch from main to 5.0 October 14, 2026 14:55
@Maxcastel
Maxcastel marked this pull request as draft October 14, 2026 14:58
@Maxcastel
Maxcastel marked this pull request as ready for review October 15, 2026 07:52
@soyuka
soyuka merged commit 431ab66 into api-platform:5.0 Oct 16, 2026
108 of 117 checks passed
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.

2 participants