I have a DataObject "Rectangle". It stands in a many\_many relationship with "AttributeValue" (e.g. 10 inch). The DataObject "AttributeValue" stands also in a many\_many relationship to "Attribute" (e.g. length (or width)). I want to create a table in the CMS on the page "Rectangle", which shows the AttributeValue and the related Attribute:

**Attribute | Value**

length | 10 inch

width | 20 inch

color | red

Cause Attribute is not related to Rectangle, I don't know how to get the data in that table. The values for the table are generated with this code:

```
class Rectangle extends Page {
    private static $db = array(...);
    private static $many_many = array(
        'AttributeValue' => 'AttributeValue',
    );
    public function getCMSFields() {
        $fields = parent::getCMSFields();

        $config = GridFieldConfig_RelationEditor::create();
        $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array(
            'AttributeValue'=>'Value'
        ));

        $attrField = new GridField(
            'AttributeValue',
            'AttributeValue',
            $this->AttributeValue(),
            $config
        );

        $fields->addFieldToTab('Root.Attribute', $attrField);        
        return $fields;
    }
}
class AttributeValue extends DataObject {
    private static $db = array('AttributeValue' => 'Varchar');
    private static $belongs_many_many = array('Rectangle' => 'Rectangle');
    private static $many_many   = array('Attribute' => 'Attribute');
}

class Attribute extends DataObject {
    private static $db = array('Attribute' => 'Varchar');   
    private static $belongs_many_many = array('AttributeValue' => 'AttributeValue');
}

```

**EDIT:**

I have a `Rectangle` with some `AttributeValues` related to it (e.g. 10 inch, 20 inch, red), so in the database there's a table Rectangle\_AttributeValue, which shows the relation. I also have the Object `Attribute` which is related to `AttributeValue` (table AttributeValue\_Attribute), e.g. 10 inch -> length, or red -> color. So the whole "relation chain" looks like: Rectangle->AttributeValue->Attribute (Rectangle1 -> 10 inch -> length, or Rectangle1 -> red -> color). I hope I could make it more clear...