<?php

class Game extends Model
{

    // ===========
    // = Statics =
    // ===========

    protected static $table_name = 'MJ_GAME';

    public static function getList()
    {
        $stm = parent::exec('GAME_LIST');
        return $stm->fetchAll();
    }

    public static function getListPublic()
    {
        $stm = parent::exec('GAME_LIST_PUBLIC');
        return $stm->fetchAll();
    }

    public static function getRow($id)
    {
        $stm = parent::exec('GAME_GET_WITH_ID', ['id' => $id]);
        return $stm->fetchAll();
    }

    public static function createGame($array)
    {
        $begin_date = date('Y-m-d H:i:s');
        $pimped_array = array_merge($array, ['creation_time'=>$begin_date]);
        $stm = parent::exec('GAME_CREATE', $pimped_array);
    }

}