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 /

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

Filtering Pages on multiple many-many related DataObjects

Go to End

3 Posts   1438 Views


Community Member, 16 Posts

9 April 2011 at 10:11pm


I'm having problems with filtering Pages on their many-many related DataObjects.

I have a CompanyPage. Each CompanyPage has a many-many relation with four DataObjects (Levels, Products, Markets, Competences).

In the CompanyHolderPage I would like to have a combined filter for these DataObjects, where the user can choose a combination of levels, products, markets and competences and the output will be a list of the corresponding pages for which this is true.

Does any one have any example code or a hint in the right direction?




Forum Moderator, 1849 Posts

18 April 2011 at 7:09am

This is not the right way - but I've used it as it is quick and easy...

class MyModelAdmin_CollectionController extends ModelAdmin_CollectionController {
	function getSearchQuery($searchCriteria){
		$query = parent::getSearchQuery($searchCriteria);

		if ($this->modelClass == 'MyModel'){
			$query->where[] = ''; //ADD YOUR SQL HERE, using stuff from $searchCriteria


Community Member, 16 Posts

27 April 2011 at 7:46pm

Thanks for your reply. Maybe this is the right direction. Right now I have four dropdown boxes, one for each dataobject, but not a combination of them.