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.

Data Model Questions /

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

ManyManyComplexTableField produced field list is ambiguous error


Go to End


2023 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