When publishing a Display Page Template to Live, or activating staging, the DDMStructureLink is not copied as well, so we have 2 Display Page Templates (1 in local, 1 in live site) that point to a DDMStructureLink.
However, since the DDMStructureLink only points back to one of them, calls to getUniqueDDMStructureLink to find the DDMStructureLink of a LayoutPageTemplateEntry when needed to find DDMStructure (or to remove link itself like when using deletion), there are times when we fail to find the DDMStructureLink.
If we Activate staging, causing the display page templates to publish to live, the one on the staging site will have a missing DDMStructureLink. If we publish to live normally, the display page template will have a missing DDMStructureLink on the live site. Since users cannot normally access the live site display page templates, without using API calls, encountering this bug can be a bit more rare, although these missing database objects can cause problems in the future.
My recommendation would be to support exporting DDMStructureLinks when exporting a layoutPageTemplateEntry, since we support staging for all layoutPageTemplateEntries currently (see LayoutPageTemplateEntryStagedModelDataHandler)
Steps to Reproduce
- Create a Display Page with Mapping set to an Object / Structure (ClassNameId / ClassTypeId)
- Activate Local Staging
- Try to delete display page in local staging
Display Page deletable
Display page not deletable without any helpful errors
Tested on Tomcat 9.0.10 + MySQL 5.7
Portal master GIT ID: 9bbc1feff22ff47bb79aaff90920f5f0e09f291e