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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

ComponentSet::add()


Go to End


1457 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)