public function removeAll($guid, $relationship = "", $inverse_relationship = false, $type = '')
{
$guid = (int) $guid;
$params = [];
if (!empty($relationship)) {
$where = "AND er.relationship = :relationship";
$params[':relationship'] = $relationship;
} else {
$where = "";
}
if (!empty($type)) {
if (!$inverse_relationship) {
$join = "JOIN {$this->db->prefix}entities e ON e.guid = er.guid_two";
} else {
$join = "JOIN {$this->db->prefix}entities e ON e.guid = er.guid_one";
$where .= " AND ";
}
$where .= " AND e.type = :type";
$params[':type'] = $type;
} else {
$join = "";
}
$guid_col = $inverse_relationship ? "guid_two" : "guid_one";
$this->db->deleteData("\n\t\t\tDELETE er FROM {$this->db->prefix}entity_relationships AS er\n\t\t\t{$join}\n\t\t\tWHERE {$guid_col} = {$guid}\n\t\t\t{$where}\n\t\t", $params);
return true;
}