Elgg\Database\RelationshipsTable::getAll PHP Method

getAll() public method

Get all the relationships for a given GUID.
public getAll ( integer $guid, boolean $inverse_relationship = false ) : ElggRelationship[]
$guid integer GUID of the subject or target entity (see $inverse)
$inverse_relationship boolean Is $guid the target of the deleted relationships? By default $guid is the subject of the relationships.
return ElggRelationship[]
    public function getAll($guid, $inverse_relationship = false)
    {
        $params[':guid'] = (int) $guid;
        $where = $inverse_relationship ? "guid_two = :guid" : "guid_one = :guid";
        $query = "SELECT * from {$this->db->prefix}entity_relationships WHERE {$where}";
        return $this->db->getData($query, [$this, 'rowToElggRelationship'], $params);
    }