<?php


namespace App\Components\DataGrids;


use App\Model\Entities\Game;
use App\Model\Exceptions\Components\RequiredDataNotSetException;
use App\Model\Facades\GameFacade;
use App\Model\Translator;
use Ublaboo\DataGrid\DataGrid;

abstract class BaseMmoGameDataGrid extends BaseDataGrid
{
    /** @var Game */
    protected $game;
    /** @var GameFacade */
    protected $gameFacade;

    public function __construct(Translator $translator, GameFacade $gameFacade)
    {
        parent::__construct($translator);
        $this->gameFacade = $gameFacade;
    }


    /**
     * @param Game $game
     */
    public function setGame(Game $game)
    {
        $this->game = $game;
    }

    protected function createComponentGrid() : DataGrid
    {
        if (!$this->game instanceof Game) {
            throw new RequiredDataNotSetException();
        }

        return parent::createComponentGrid();
    }

}