src/ORM/DataObjectSchema.php
protected function getManyManyInverseRelationship($childClass, $parentClass)
    {
        $otherManyMany = Config::inst()->get($childClass, 'many_many', Config::UNINHERITED);
        if (!$otherManyMany) {
            return null;
        }
        foreach ($otherManyMany as $inverseComponentName => $manyManySpec) {
            // Normal many-many
            if ($manyManySpec === $parentClass) {
                return $inverseComponentName;
            }
            // many-many through, inspect 'to' for the many_many
            if (is_array($manyManySpec)) {
                $toClass = $this->hasOneComponent($manyManySpec['through'], $manyManySpec['to']);
                if ($toClass === $parentClass) {
                    return $inverseComponentName;
                }
            }
        }
        return null;
    }
protected function getManyManyInverseRelationship($childClass, $parentClass)
    {
        $otherManyMany = Config::inst()->get($childClass, 'many_many', Config::UNINHERITED);
        if (!$otherManyMany) {
            return null;
        }
        foreach ($otherManyMany as $inverseComponentName => $manyManySpec) {
            // Normal many-many
            if ($manyManySpec === $parentClass) {
                return $inverseComponentName;
            }
            // many-many through, inspect 'to' for the many_many
            if (is_array($manyManySpec)) {
                $toClass = $this->hasOneComponent($manyManySpec['through'], $manyManySpec['to']);
                if ($toClass === $parentClass) {
                    return $inverseComponentName;
                }
            }
        }
        return null;
    }
protected function getManyManyInverseRelationship ( $ childClass , $ parentClass ) { $ otherManyMany = Config :: inst ( ) -> get ( $ childClass , 'many_many' , Config :: UNINHERITED ) ; if ( ! $ otherManyMany ) { return null ; } foreach ( $ otherManyMany as $ inverseComponentName => $ manyManySpec ) { // Normal many-many if ( $ manyManySpec === $ parentClass ) { return $ inverseComponentName ; } // many-many through, inspect 'to' for the many_many if ( is_array ( $ manyManySpec ) ) { $ toClass = $ this -> hasOneComponent ( $ manyManySpec [ 'through' ] , $ manyManySpec [ 'to' ] ) ; if ( $ toClass === $ parentClass ) { return $ inverseComponentName ; } } } return null ; }
Find a many_many on the child class that points back to this many_many

@param string $childClass
@param string $parentClass

@return string|null
Find a many_many on the child class that points back to this many_many