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

DataObject::get Many_Many


Go to End


1207 Views

Avatar
Cy

Community Member, 11 Posts

23 October 2008 at 8:01pm

I am getting a "Bad class to singleton() - Listing_PropertyTypes" error. The Listing and PropertyType objects have a many to many relationship.

function ListingsByType() {
      $where = "PropertyTypeID = 1";
   }
   return DataObject::get("Listing_PropertyTypes", $where);
}

I'm trying to return all the Listings that have a certain PropertyType (ie. 1). Am I on the right track here? I'd actually like to return results from the Listing table and NOT the "join" table.

Thanks!