function __construct($controller, $name, $sourceClass, $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "")
 {
     parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
     //Sort by heirarchy, depending on number of parents indent
     $classes = array_reverse(ClassInfo::ancestry($this->controllerClass()));
     foreach ($classes as $class) {
         $singleton = singleton($class);
         $manyManyRelations = $singleton->uninherited('many_many', true);
         if (isset($manyManyRelations) && array_key_exists($this->name, $manyManyRelations)) {
             $this->manyManyParentClass = $class;
             $this->manyManyTable = $class . '_' . $this->name;
             break;
         }
         $belongsManyManyRelations = $singleton->uninherited('belongs_many_many', true);
         if (isset($belongsManyManyRelations) && array_key_exists($this->name, $belongsManyManyRelations)) {
             $singleton = singleton($belongsManyManyRelations[$this->name]);
             $manyManyRelations = $singleton->uninherited('many_many', true);
             $this->manyManyParentClass = $class;
             $relation = array_flip($manyManyRelations);
             $this->manyManyTable = $belongsManyManyRelations[$this->name] . '_' . $relation[$class];
             break;
         }
     }
     $tableClasses = ClassInfo::dataClassesFor($this->sourceClass);
     $source = array_shift($tableClasses);
     $sourceField = $this->sourceClass;
     if ($this->manyManyParentClass == $sourceField) {
         $sourceField = 'Child';
     }
     $parentID = $this->controller->ID;
     $this->sourceJoin .= " LEFT JOIN \"{$this->manyManyTable}\" ON (\"{$source}\".\"ID\" = \"{$this->manyManyTable}\".\"{$sourceField}ID\" AND \"{$this->manyManyTable}\".\"{$this->manyManyParentClass}ID\" = '{$parentID}')";
     $this->joinField = 'Checked';
 }
	function __construct($controller, $name, $sourceClass, $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") {

		Deprecation::notice('3.0', 'Use GridField with GridFieldConfig_RelationEditor');

		parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
		
		$classes = array_reverse(ClassInfo::ancestry($this->controllerClass()));
		foreach($classes as $class) {
			$singleton = singleton($class);
			$manyManyRelations = $singleton->uninherited('many_many', true);
			if(isset($manyManyRelations) && array_key_exists($this->name, $manyManyRelations)) {
				$this->manyManyParentClass = $class;
				$manyManyTable = $class . '_' . $this->name;
				break;
			}
			$belongsManyManyRelations = $singleton->uninherited( 'belongs_many_many', true );
			 if( isset( $belongsManyManyRelations ) && array_key_exists( $this->name, $belongsManyManyRelations ) ) {
				$this->manyManyParentClass = $class;
				$manyManyTable = $belongsManyManyRelations[$this->name] . '_' . $this->name;
				break;
			}
		}
		$tableClasses = ClassInfo::dataClassesFor($this->sourceClass);
		$source = array_shift($tableClasses);
		$sourceField = $this->sourceClass;
		if($this->manyManyParentClass == $sourceField)
			$sourceField = 'Child';
		$parentID = $this->controller->ID;
		
		$this->sourceJoin .= " LEFT JOIN \"$manyManyTable\" ON (\"$source\".\"ID\" = \"$manyManyTable\".\"{$sourceField}ID\" AND \"{$this->manyManyParentClass}ID\" = '$parentID')";
		
		$this->joinField = 'Checked';
	}
 function __construct($controller, $name, $sourceClass, $fieldList, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "")
 {
     parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
     $classes = array_reverse(ClassInfo::ancestry($this->controller->ClassName));
     foreach ($classes as $class) {
         $singleton = singleton($class);
         $manyManyRelations = $singleton->uninherited('many_many', true);
         if (isset($manyManyRelations) && array_key_exists($this->name, $manyManyRelations)) {
             $this->manyManyParentClass = $class;
             $manyManyTable = $class . '_' . $this->name;
             break;
         }
         $belongsManyManyRelations = $singleton->uninherited('belongs_many_many', true);
         if (isset($belongsManyManyRelations) && array_key_exists($this->name, $belongsManyManyRelations)) {
             $this->manyManyParentClass = $class;
             $manyManyTable = $belongsManyManyRelations[$this->name] . '_' . $this->name;
             break;
         }
     }
     $source = $this->sourceClass;
     $sourceField = $this->sourceClass;
     if ($this->manyManyParentClass == $source) {
         $sourceField = 'Child';
     }
     $parentID = $this->controller->ID;
     $this->sourceJoin .= " LEFT JOIN `{$manyManyTable}` ON (`{$source}`.`ID` = `{$sourceField}ID` AND `{$this->manyManyParentClass}ID` = '{$parentID}')";
     $this->joinField = 'Checked';
 }