Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » ComponentSet::add()

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1211 Views
  • xmedeko
    Community Member
    94 Posts

    ComponentSet::add() Link to this post

    I have a class XEHotel, which is a subclass of XEProduct. I am trying ComponentSet::add($XEHotel) and got such error:

    user_error(ComponentSet::add() Tried to add an 'XEHotel' object, but 'XEProduct' expected,256)
    line 93 of ComponentSet.php

    I had a look into ComponentSet.php and see the comment:
    // TODO Should this allow subclasses?
    I think, it definitely should. I know, that I can always use ComponentSet::add($XEHotel->ID)

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.