title: Silverstripe $many_many relationship with an attribute on the relationship
body: <p>When adding a many_many relationship much like the projects to mentors relationship in the silverstripe guide:</p>
  
  <p><a href="http://doc.silverstripe.org/framework/en/tutorials/5-dataobject-relationship-management" rel="nofollow">http://doc.silverstripe.org/framework/en/tutorials/5-dataobject-relationship-management</a></p>
  
  <p>I'd like to record an attribute against the relationship. So for example "active" - yes /no field for the mentor on the project.  But the mentor might have a different value for active for different projects she is related to. </p>
  
  <p>Whats the best way to achieve this with Silverstripe's built in tools?</p>
  
  <p>UPDATE
  with some help from IRC &amp; the answer below.  ive gotten a bit closer, bit its not working. Ive found this:
  <a href="https://github.com/chillu/silverstripe-framework/blob/c8136f5d4c8a37a4da274cd1c93907c0a2af86a7/docs/en/reference/grid-field.md" rel="nofollow">https://github.com/chillu/silverstripe-framework/blob/c8136f5d4c8a37a4da274cd1c93907c0a2af86a7/docs/en/reference/grid-field.md</a>
  which seems very relevant.</p>
  
  <p>so DebatePages have many_many panelists who can vote differently on each debate. </p>
  
  <p>DebatePage.php</p>
  
  <pre><code>  private static $many_many = array(
      'Panelists'     =&gt; 'Panelist',
      'RelationTags'  =&gt; 'Tag'
    );
    public static $many_many_extraFields = array(
      'Panelists' =&gt; array('Motion' =&gt; 'Boolean')
    );
  
  
  
  
  public function getCMSFields() {
      .....
      if($this-&gt;ID) {
              $panelistFields = singleton('Panelist')-&gt;getCMSFields();
              $panelistFields-&gt;addFieldToTab(
                  'Root.Main',
                  // Please follow the "ManyMany[&lt;extradata-name&gt;]" convention
                  new TextField('ManyMany[Motion]', 'Agree with Motion')
              );
              $config = GridFieldConfig_RelationEditor::create();
              $config-&gt;getComponentByType('GridFieldDetailForm')-&gt;setFields($panelistFields);
              $gridField = new GridField('Panelists', 'Panelists', $this-&gt;Panelists(), $config);
              $fields-&gt;findOrMakeTab('Root.Panelists')-&gt;replaceField('Panelist', $gridField);
          }        
      }
  </code></pre>