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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Adding "where" clause to new DataObjectManager


Reply


428 Views

Avatar
Fraser

Community Member, 47 Posts

6 July 2012 at 4:32pm

I need to add a where clause to my DataObjectManager.

My existing code looks like this:

$fields->addFieldToTab('Root.Backgrounds', new ImageDataObjectManager(
         $this->owner,
         'BackgroundImages',
         'BackgroundImage',
));

I have tried simply adding it like the below but it doesn't apply the filter and I always end up with all the BackgroundImages returned, not those with the required SubSiteID.

$fields->addFieldToTab('Root.Backgrounds', new ImageDataObjectManager(
         $this->owner,
         'BackgroundImages',
         'BackgroundImage',
         "'BackgroundImage.SiteConfigID' = '".$this->owner->SubsiteID."'"
      ));

Can someone tell me where I am going wrong please?