Skip to content

Commit

Permalink
Merge pull request #16404 from craftcms/bugfix/16394-merging-entry-ty…
Browse files Browse the repository at this point in the history
…pes-and-ensuring-singles

merging entry types and ensuring singles - ensure the type is actually unset
  • Loading branch information
brandonkelly authored Jan 11, 2025
2 parents ec7fd94 + da08dc0 commit 0dccb7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed a bug where the control panel could display a notice about the Craft CMS license belonging to a different domain, even when accessing the control panel from the correct domain. ([#16396](https://github.com/craftcms/cms/issues/16396))
- Fixed a bug where field layout elements’ action menus could have an empty action group.
- Fixed a bug where Single section entries could be duplicated after running the `entry-types/merge` command. ([#16394](https://github.com/craftcms/cms/issues/16394))

## 5.5.9 - 2025-01-06

Expand Down
5 changes: 4 additions & 1 deletion src/services/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,9 @@ private function _ensureSingleEntry(Section $section, ?array $siteSettings = nul
// if we didn't find any, try without the typeId,
// in case that changed to something completely new
if ($entry === null) {
$entry = $baseEntryQuery->one();
$entry = $baseEntryQuery
->typeId(null)
->one();

if ($entry !== null) {
$entry->setTypeId($entryTypeIds[0]);
Expand All @@ -977,6 +979,7 @@ private function _ensureSingleEntry(Section $section, ?array $siteSettings = nul
// try without the typeId with trashed where they were deleted with entry type
if ($entry === null) {
$entry = $baseEntryQuery
->typeId(null)
->trashed(null)
->where(['entries.deletedWithEntryType' => true])
->one();
Expand Down

0 comments on commit 0dccb7d

Please sign in to comment.