<?php

namespace Mine\SeekerBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
 * Grid
 *
 * @ORM\Table(name="grid")
 * @ORM\Entity(repositoryClass="Mine\SeekerBundle\Repository\GridRepository")
 */
class Grid
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var PlayedGame
     *
     * @ORM\OneToOne(targetEntity="Mine\SeekerBundle\Entity\PlayedGame", inversedBy="grid", cascade={"persist"})
     */
    private $playedGame;

    /**
     * @var GridRow
     *
     * @ORM\OneToMany(targetEntity="Mine\SeekerBundle\Entity\GridRow", mappedBy="grid", cascade={"persist"})
     * @ORM\JoinColumn(name="grid_row", referencedColumnName="id", onDelete="CASCADE")
     */
    private $gridRow;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->gridRow = new ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set playedGame
     *
     * @param PlayedGame $playedGame
     *
     * @return Grid
     */
    public function setPlayedGame(PlayedGame $playedGame = null)
    {
        $this->playedGame = $playedGame;

        return $this;
    }

    /**
     * Get playedGame
     *
     * @return PlayedGame
     */
    public function getPlayedGame()
    {
        return $this->playedGame;
    }

    /**
     * Add gridRow
     *
     * @param GridRow $gridRow
     *
     * @return Grid
     */
    public function addGridRow(GridRow $gridRow)
    {
        $this->gridRow[] = $gridRow;

        return $this;
    }

    /**
     * Remove gridRow
     *
     * @param GridRow $gridRow
     */
    public function removeGridRow(GridRow $gridRow)
    {
        $this->gridRow->removeElement($gridRow);
    }

    /**
     * Get gridRow
     *
     * @return Collection
     */
    public function getGridRow()
    {
        return $this->gridRow;
    }
}
