Resources: SilverStripe

Add field to a many_many relationship

19 November 2014

Sorting dataobjects in a many_many requires the sort to be on the relationship, rather than the parent or child dataobject. You can add any fields to this relationship database with $many_many_extraFields.

MyClass.php

	static $many_many_extraFields = array(
		'RelationshipFieldName' => array(
			'FieldName' => 'FieldType'
		)
	);

Tags: , ,

Let's work together