Skip to content
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

Make setting field values via Entry::EVENT_BEFORE_SAVE work when $firstSave is true #15372

Merged
merged 7 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Fixed a bug where content changes created via `craft\base\Element::EVENT_AFTER_SAVE` weren’t getting saved, when an element was getting fully saved from an unsaved draft state. ([#15369](https://github.com/craftcms/cms/issues/15369))
- Updated web-auth/webauthn-lib to 4.9. ([#15377](https://github.com/craftcms/cms/issues/15377))

## 5.2.8 - 2024-07-17
Expand Down
2 changes: 1 addition & 1 deletion src/services/Drafts.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public function removeDraftData(ElementInterface $draft): void
try {
// no need to propagate or save content here – and it could end up overriding any
// content changes made to other sites from a previous onAfterPropagate(), etc.
if ($draft->hasErrors() || !Craft::$app->getElements()->saveElement($draft, false, false, saveContent: false)) {
if ($draft->hasErrors() || !Craft::$app->getElements()->saveElement($draft, false, false)) {
throw new InvalidElementException($draft, "Draft $draft->id could not be applied because it doesn't validate.");
}
Db::delete(Table::DRAFTS, [
Expand Down