ElggEntity::removeRelationship PHP Method

removeRelationship() public method

Remove a relationship
See also: ElggEntity::addRelationship()
See also: ElggEntity::deleteRelationships()
public removeRelationship ( integer $guid_two, string $relationship ) : boolean
$guid_two integer GUID of the target entity of the relationship.
$relationship string The type of relationship.
return boolean
    public function removeRelationship($guid_two, $relationship)
    {
        return remove_entity_relationship($this->getGUID(), $relationship, $guid_two);
    }

Usage Example

Example #1
0
 public function testEntityMethodRemoveRelationship()
 {
     $this->assertTrue($this->entity1->addRelationship($this->entity2->guid, 'test_relationship'));
     $r = check_entity_relationship($this->entity1->guid, 'test_relationship', $this->entity2->guid);
     $this->assertIsA($r, 'ElggRelationship');
     $this->assertTrue($this->entity1->removeRelationship($this->entity2->guid, 'test_relationship'));
     $this->assertFalse(check_entity_relationship($this->entity1->guid, 'test_relationship', $this->entity2->guid));
 }