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   1047 Views

Avatar
baba-papa

Community Member, 279 Posts

20 January 2010 at 1:50pm

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

Forum Moderator, 5513 Posts

20 January 2010 at 6:02pm

Edited: 21/01/2010 8:49am

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

Community Member, 279 Posts

21 January 2010 at 12:42am

Great, thanks willr.