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, biapar, Willr, Ingo, swaiba

ManyManyComplexTableField produced field list is ambiguous error


Go to End
Reply


1520 Views

Avatar
teejay

Community Member, 63 Posts

2 June 2010 at 9:17pm

Hi folks,

I have got a wierd issue with a many_many relation. I have 2 Pages a ProjectHolder and a ServicePage. The ProjectHolder page has many_many relation the ServicePage. When I add the field to the CMSFields it will come up with a nice annoying error.

...... CASE WHEN "SiteTree"."ClassName" IS NOT NULL THEN "SiteTree"."ClassName" ELSE 'SiteTree' END ORDER BY "Sort" LIMIT 10 OFFSET 0 Column 'ProjectHolderID' in field list is ambiguous

here is my Projectholder

class ProjectHolder extends Page {
	
	public static $many_many = array(
		'Services'=>'ServicePage'
	);
	
	
	function getCMSFields() {
		$fields = parent::getCMSFields();
		
		$tablefield = new ManyManyComplexTableField(
		    $this,
		    'Services',
		    'ServicePage',
		    null,
			'getCMSFields_forPopup'
		);
	    $fields->addFieldToTab("Root.Content.Services",$tablefield);	
	return $fields;
	}
}

and here is my ServicePage
class ServicePage extends Page {
	
	static $belongs_many_many = array(
           'ProjectHolders' => 'ProjectHolder'
   	);
	
}

Does anyone have an idea as to what the issue could be ? Thx