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.

Data Model Questions

DataObject already in DataObjectSet?


Reply

3 Posts   1020 Views

Avatar
baba-papa

20 January 2010 at 1:50pm Community Member, 279 Posts

How can I check if a DataObject is already in a DataObjectSet? I tried in_array() but it can´t cope with object sets.

Avatar
Willr

20 January 2010 at 6:02pm (Last edited: 21 January 2010 8:49am), Forum Moderator, 5511 Posts

You could try using containsIDs() and passing in the ID of your dataobject or you could use find().

$set->containsIDs(array($object->ID));

// or

$set->find('ID', $object->ID);

Avatar
baba-papa

21 January 2010 at 12:42am Community Member, 279 Posts

Great, thanks willr.