2026-04-09 20:21:01 +02:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
/*
|
2019-10-27 18:51:03 +01:00
|
|
|
* This file is part of the SplendidBear Websites' projects.
|
|
|
|
|
*
|
2026-04-20 21:24:39 +02:00
|
|
|
* Copyright (c) 2019 @ www.splendidbear.org
|
2019-10-27 18:51:03 +01:00
|
|
|
*
|
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
|
*/
|
2019-10-27 13:35:33 +01:00
|
|
|
|
|
|
|
|
namespace App\Entity;
|
|
|
|
|
|
2026-04-09 20:21:01 +02:00
|
|
|
use App\Repository\GridRepository;
|
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
|
|
use Doctrine\ORM\Mapping\Column;
|
|
|
|
|
use Doctrine\ORM\Mapping\Entity;
|
|
|
|
|
use Doctrine\ORM\Mapping\GeneratedValue;
|
|
|
|
|
use Doctrine\ORM\Mapping\Id;
|
|
|
|
|
use Doctrine\ORM\Mapping\JoinColumn;
|
|
|
|
|
use Doctrine\ORM\Mapping\OneToMany;
|
|
|
|
|
use Doctrine\ORM\Mapping\OneToOne;
|
2019-10-27 13:35:33 +01:00
|
|
|
|
|
|
|
|
/**
|
2019-10-27 18:51:03 +01:00
|
|
|
* Class Grid
|
|
|
|
|
*
|
2026-04-09 20:21:01 +02:00
|
|
|
* @package App\Entity
|
|
|
|
|
* @author Lang <https://www.splendidbear.org>
|
|
|
|
|
* @category Class
|
|
|
|
|
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
|
|
|
|
* @link www.splendidbear.org
|
2026-04-20 21:24:39 +02:00
|
|
|
* @since 2019. 10. 27.
|
2019-10-27 13:35:33 +01:00
|
|
|
*/
|
2026-04-09 20:21:01 +02:00
|
|
|
#[Entity(repositoryClass: GridRepository::class)]
|
2019-10-27 13:35:33 +01:00
|
|
|
class Grid
|
|
|
|
|
{
|
2026-04-09 20:21:01 +02:00
|
|
|
#[Id, GeneratedValue, Column]
|
2026-04-20 09:05:36 +02:00
|
|
|
public private(set) ?int $id = null;
|
2026-04-09 20:21:01 +02:00
|
|
|
|
|
|
|
|
#[OneToOne(inversedBy: 'grid', cascade: ['persist'])]
|
2026-04-20 09:05:36 +02:00
|
|
|
public ?PlayedGame $playedGame = null;
|
2019-10-27 13:35:33 +01:00
|
|
|
|
2026-04-20 09:05:36 +02:00
|
|
|
#[OneToMany(targetEntity: GridRow::class, mappedBy: 'grid', cascade: ['persist'])]
|
2026-04-09 20:21:01 +02:00
|
|
|
#[JoinColumn(name: 'grid_row', referencedColumnName: 'id', onDelete: 'CASCADE')]
|
2026-04-20 09:05:36 +02:00
|
|
|
public private(set) Collection $gridRow;
|
2019-10-27 13:35:33 +01:00
|
|
|
|
2026-04-09 20:21:01 +02:00
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this->gridRow = new ArrayCollection();
|
|
|
|
|
}
|
2019-10-27 13:35:33 +01:00
|
|
|
|
2026-04-09 20:21:01 +02:00
|
|
|
public function addGridRow(GridRow $gridRow): void
|
|
|
|
|
{
|
|
|
|
|
$this->gridRow->add($gridRow);
|
2026-04-20 09:05:36 +02:00
|
|
|
$gridRow->grid = $this;
|
2026-04-09 20:21:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function removeGridRow(GridRow $gridRow): void
|
2019-10-27 13:35:33 +01:00
|
|
|
{
|
2026-04-09 20:21:01 +02:00
|
|
|
$this->gridRow->removeElement($gridRow);
|
2019-10-27 13:35:33 +01:00
|
|
|
}
|
|
|
|
|
}
|