Jump to:

23576 Posts in 19403 Topics by 2893 members

General Questions

SilverStripe Forums » General Questions » Why isn't my requireDefaultRecords() being called?

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

Page: 1
Go to End
Author Topic: 815 Views
  • brianmwaters
    Avatar
    Community Member
    5 Posts

    Why isn't my requireDefaultRecords() being called? Link to this post

    I have a class ETSCustomer which decorates Member. (Actually, it's a subclass of EcommerceRole from the ecommerce module.)

    It's registered like this in mysite/_config.php:
    Object::remove_extension('Member', 'EcommerceRole');
    Object::add_extension('Member', 'ETSCustomer');
    And it seems to be working properly, except that it's requireDefaultRecords() method is not being called on /dev/build.

    I'm not familiar enough with SS to know how methods are dispatched on /dev/build. Anyone have any thoughts as to why my method isn't getting called?

  • brianmwaters
    Avatar
    Community Member
    5 Posts

    Re: Why isn't my requireDefaultRecords() being called? Link to this post

    simon_w answered this for me in on the IRC channel. For archive purposes, I'll list it here:

    It's because Member, which my class decorates, doesn't call parent::requireDefaultRecords() or extend('requireDefaultRecords'), so that method never gets called in the decorator. Apparently it's been fixed in SS 3.

    815 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.