Hi there, I tried to extend the Member Object with a Friendship Relation.
Therefore the Member Object gets a many_many relation to itself.
Here is some code:
class BaseMember extends DataExtension {
private static $many_many = array(
'FriendsRequested' => 'Member'
);
private static $belongs_many_many = array(
'FriendsAccepted' => 'Member.FriendsRequested'
);
public function Friends(){
return $this->owner->FriendsRequested()->innerJoin("Member_FriendsRequested", "\"Member_FriendsRequested\".\"MemberID\" = \"FriendsAccepted\".\"ChildID\" AND \"Member_FriendsRequested\".\"ChildID\" = \"FriendsAccepted\".\"MemberID\"", "FriendsAccepted");
}
}
Now I ran into the Problem, that a many_many relation to itself leads to a "Inverse component of Member.FriendsRequested not found (Member)" Error on ModelAdmin. Everywhere else this is working without any errors or Problems.
I allready tried to remove the FriendsRequested Tab from the CMS Fields (by using updateCMSFields), but without any success.
Does anyone of you have an idea, how to solve this, as I really need access to the ModelAdmin in the Backend again.