Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Can DataObjects have Controllers?

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 867 Views
  • Jonn
    Avatar
    Community Member
    10 Posts

    Can DataObjects have Controllers? Link to this post

    Hi,

    Can DataObjects have controllers like:

    class SomeObject extends DataObject {
    ...
    }

    class SomeObject_Controller extends ContentController {
    ...
    }

    and would that controller work the same way the page controllers work?

    I've tried a few different ways of doing this but the methods inside the controller aren't recognized on the page.

    Thanks.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Can DataObjects have Controllers? Link to this post

    No, a DataObject is just arbitrary data. It doesn't know anything about templates or controllers. You'll have to build a custom page controller to display the content of a DataObject.

    ---------------
    Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

    867 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.