silverstripe / cwp

Common Web Platform (CWP) features module. We strongly recommend using it for all new CWP projects. Future features will be delivered here.
https://www.cwp.govt.nz
BSD 3-Clause "New" or "Revised" License
10 stars 26 forks source link

Unable to remove a Related Page from the live stage once it has been added to a page #332

Open adunn49 opened 1 year ago

adunn49 commented 1 year ago

Summary of set up

I have a page type that extends BasePage on which you can add Related Pages. The template for my page type loops through $RelatedPagesThrough and outputs them to the view.

Issue

It seems that once a related page has been added and published there is no way to remove it from the live page (other than unpublish or delete the related page).

Steps to reproduce issue

Observations at this point are that the related page appears on the main page.

Also, looking at the database entries the BasePage_RelatedPages_Live table (many many through table) now has the expected entry linking the two pages, as does BasePage_RelatedPages.

At this point we now try to remove the related page:

Inspecting the tables again the entry has been removed from BasePage_RelatedPages but it still exists in BasePage_RelatedPages_Live.

Also, in the CMS the draft view no longer shows the related page but the published one still shows it.

GuySartorelli commented 1 year ago

If you publish the page after clicking unlink, does the link get removed from the _Live table? Also, what version of this module are you reporting this for?

GuySartorelli commented 1 year ago

I'm labelling this as a bug for now, but without additional information it won't be prioritised,

callan-stretton commented 1 year ago

@GuySartorelli I am experiencing this issue too. I can confirm that Publishing the related page does not have any effect. (Version 2.11.0)

adunn49 commented 1 year ago

@GuySartorelli Sorry, just looping back to this. I can also confirm that publishing the page after unlinking does not remove the relevant entry from the _Live table. Using version 2.10.1 of the module.

michalkleiner commented 4 months ago

BasePage just needs adding

private static $cascade_deletes = [
    'RelatedPagesThrough',
];
michalkleiner commented 4 months ago

Just came across the same issue