<?php

function mapIdentifierToMember($sqlMember) {
    return Member::Get($sqlMember['identifier']);
}

function mapIdentifierToArticle($sqlArticle) {
    return Article::Get($sqlArticle['identifier']);
}

function mapIdentifierToMemberRight($sqlRight) {
    return MemberRight::Get($sqlRight['rightId']);
}

function mapIdentifierToCategory($sqlCategory) {
    if (key_exists("identifier", $sqlCategory)) {
        return Category::Get($sqlCategory['identifier']);
    } else {
        return Category::Get($sqlCategory['categoryId']);
    }
}

function mapIdentifierToTournamentEntry($sqlEntry) {
    $entryId = $sqlEntry['entryId'];
    return TournamentEntry::Get($entryId);
}

function mapIdentifierToMenuEntry($sqlEntry) {
    return MenuEntry::Get($sqlEntry['identifier']);
}

function mapIdentifierToTournament($sqlTournament) {
    return Tournament::GetSQL($sqlTournament);
}

/**
 *
 * @param Member $user
 * @return bool true if the user is a member, false otherwise
 */
function selectMembers(Member $user) {
    return MemberRightArray::hasRightNamed($user, "Membre");
}
?>
