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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

ComponentSet::add()


Go to End


1604 Views

Avatar
xmedeko

Community Member, 94 Posts

17 July 2007 at 6:28pm

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)