diff --git a/data/Relationships/M2MRelationship.php b/data/Relationships/M2MRelationship.php index b8dcdef2c4f..4e5caec9fae 100755 --- a/data/Relationships/M2MRelationship.php +++ b/data/Relationships/M2MRelationship.php @@ -145,7 +145,7 @@ public function add($lhs, $rhs, $additionalFields = array()) //Need to hijack this as security groups will not contain a link on the module side //due to the way the module works. Plus it would remove the relative ease of adding custom module support - if (get_class($rhs) != 'User' && get_class($rhs) != 'ACLRole' && get_class($lhs) == 'SecurityGroup') { + if (get_class($rhs) != 'User' && get_class($rhs) != 'ACLRole' && get_class($lhs) == 'SecurityGroup' && get_class($rhs) != 'SecurityGroup') { $rhs->$rhsLinkName->addBean($lhs); $this->callBeforeAdd($rhs, $lhs, $rhsLinkName); @@ -153,7 +153,7 @@ public function add($lhs, $rhs, $additionalFields = array()) $this->addRow($dataToInsert); $rhs->$rhsLinkName->addBean($lhs); $this->callAfterAdd($lhs, $rhs, $lhsLinkName); - } elseif (get_class($lhs) != 'User' && get_class($lhs) != 'ACLRole' && get_class($rhs) == 'SecurityGroup') { + } elseif (get_class($lhs) != 'User' && get_class($lhs) != 'ACLRole' && get_class($rhs) == 'SecurityGroup' && get_class($lhs) != 'SecurityGroup') { $lhs->$lhsLinkName->addBean($rhs); $this->callBeforeAdd($lhs, $rhs, $lhsLinkName);