Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Redundant PageID introduced into Page in 2.4.2?


Reply


8 Posts   1166 Views

Avatar
pter

Community Member, 38 Posts

12 October 2010 at 3:32pm

Edited: 12/10/2010 10:17pm

As mentioned in http://www.silverstripe.org/general-questions/show/293504?start=8#post293637

There seems to be some sort of forced addition of a ParentID field to the Page/Page_live tables. IMO this isn't needed, but where isis coming from?

Pter

Avatar
Willr

Forum Moderator, 5513 Posts

12 October 2010 at 4:18pm

pter have you installed any modules or applied any extra decorators? I could not reproduce this extra parent ID in my default installation of branches/2.4

Avatar
pter

Community Member, 38 Posts

12 October 2010 at 5:17pm

No and don't use modules like blog, forums, etc.

Just wiped out and replaced the 3 main dirs CMS, googlesitemaps and sapphire then did a dev/rebuild. It is most odd though - cannot find anywhere it might be getting it from so will have a closer look and have an umpteenth pass at the upgrade.

Pter

Avatar
Willr

Forum Moderator, 5513 Posts

12 October 2010 at 7:16pm

If you can't see it in the $db array then I'm guessing its coming from an extension. If you can reproduce the field then debug all the extensions enabled on that class, could be one thats on Page rather than SiteTree.

Avatar
pter

Community Member, 38 Posts

12 October 2010 at 10:05pm

Edited: 12/10/2010 10:18pm

Correct and thanks Willr (for help and patience).

I have one module of mine that has in the _config.php (with the brackets indicating it does not matter if Object or DataObject):

(Data)Object::add_extension('Page', 'HidePages');

Where HidePages is an extension of Hierarchy (in hidepages.php). Find code attached if you can help... at least it isn't a critical module but was in my dev site so triggered this. Nice to find out before too late. Wondering if SS is adding something as a result? Or still me and my module... I'll rip the extension to pieces to see if that can show anything.

Update on ripping to bits: it does it even on an empty class.

class HidePages extends Hierarchy {
}

It seems to be the extension to Hierarchy (which does not happen anywhere else). Am I missing something?

Pter

Avatar
Willr

Forum Moderator, 5513 Posts

13 October 2010 at 12:07am

Well you shouldn't extend Hierarchy from hidepages. Pages will already have Hierarchy applied to them (well SiteTrees) so you're applying Hierarchy to both the SiteTree and the Page which is giving you the multiple IDs

Avatar
pter

Community Member, 38 Posts

13 October 2010 at 10:46am

Ahhh and thanks.

FYI based on some code that did work with up to and including 2.4.0 (never tried 2.4.1) so something has certainly changed, or more likely fixed, so this sort of method now becomes obviously wrong. So... while I go off and look for how to do it in this new environment, if you know and if it is a quick answer; how would I decorate/override the Hierarchy class to replace the stageChildren as desired?

Avatar
pter

Community Member, 38 Posts

13 October 2010 at 3:13pm

Edited: 13/10/2010 3:14pm

Thanks heaps Willr. Consider this closed and if I have any other probs they'll be in the other thread for the module itself.

http://www.silverstripe.org/customising-the-cms/show/280398?start=24#post293738