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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

obtain objects of a class

Go to End

2 Posts   1005 Views


Community Member, 28 Posts

13 August 2011 at 6:06pm

Hi all.

Would be like to obtain the objects of a particular class only and not all are of the same class

is for use as dropdownfield options.

I'm using DataObject:: get ('class') and this works but selects all classes and I just need this particular

Attached Files

Forum Moderator, 1899 Posts

17 August 2011 at 10:38pm

something like...

$dos = DataObject::get('class');
foreach ($dos as $do) {
   if (!in_array($do->ClassName,array('class1','class2'))) {
$map = $dos ? $dos->toDropdownMap() : array();
$df = new DropdownField($strFieldName,$strLabel,$map);