public static function syncRelations($entityguid, $userid, $relations = array()) { $entityname = EntityTypes::getTypeByGuid($entityguid); if ($entityname === null) { throw new Exception("Object entity type not found for relation"); } $relids = EntityRelations::relateDirectEntity($entityguid, "organization", $userid, $relations); EntityRelations::unrelateAll($entityguid, $relids, false, EntityRelations::getRelationTypePairIDs($entityname, "organization")); $relids = EntityRelations::relateDirectEntity($entityguid, "project", $userid, $relations); EntityRelations::unrelateAll($entityguid, $relids, false, EntityRelations::getRelationTypePairIDs($entityname, "project")); }