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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Potential issues & side-effects with having an abstract (parent) Page Controller.




19 February 2014 at 3:07pm (Last edited: 19 February 2014 3:11pm), Community Member, 159 Posts


I have implemented an abstract page controller of a parent page class, since I want the children to implement the abstract functions.

So far everything seems to be working well. But can you anticipate any issues or side-effects of having abstract parent page controllers?

Parent Page with abstract Page_Controller:

class MyParentPage extends Page {
   // ...

abstract class MyParentPage_Controller extends Page_Controller {

   abstract protected function myAbstractFunction();
   public function myFunction() {
      // ...
      return $this->myAbstractFunction();

Child Page

class MyChildPage extends MyParentPage {
   // …
   private static $hide_ancestor = 'MyParentPage';

abstract class MyChildPage_Controller extends MyParentPage_Controller {

   protected function myAbstractFunction() {
      return 'Something';