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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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


1437 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!