250 lines
5.5 KiB
PHP
250 lines
5.5 KiB
PHP
<?php declare(strict_types=1);
|
|
/*
|
|
* This file is part of the SplendidBear Websites' projects.
|
|
*
|
|
* Copyright (c) 2026 @ www.splendidbear.org
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\PlayedGameRepository;
|
|
use DateTime;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\DBAL\Types\Types;
|
|
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\ManyToOne;
|
|
use Doctrine\ORM\Mapping\OneToMany;
|
|
use Doctrine\ORM\Mapping\OneToOne;
|
|
use Symfony\Component\Uid\Uuid;
|
|
|
|
/**
|
|
* Class PlayedGame
|
|
*
|
|
* @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
|
|
* @since 2026. 04. 09.
|
|
*/
|
|
#[Entity(repositoryClass: PlayedGameRepository::class)]
|
|
class PlayedGame
|
|
{
|
|
#[Id, GeneratedValue, Column]
|
|
private ?int $id = null;
|
|
|
|
#[Column(type: 'uuid', unique: true)]
|
|
private ?Uuid $uuid = null;
|
|
|
|
#[Column(length: 50)]
|
|
private ?string $gameAssoc = null;
|
|
|
|
#[Column(length: 5, nullable: true)]
|
|
private ?int $redPoints = null;
|
|
|
|
#[Column(length: 5, nullable: true)]
|
|
private ?int $bluePoints = null;
|
|
|
|
#[Column(nullable: true)]
|
|
private ?bool $redExplodedBomb = null;
|
|
|
|
#[Column(nullable: true)]
|
|
private ?bool $blueExplodedBomb = null;
|
|
|
|
#[Column(length: 7, nullable: true)]
|
|
private ?string $resign = null;
|
|
|
|
#[Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
|
private ?DateTime $created = null;
|
|
|
|
#[Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
|
private ?DateTime $updated = null;
|
|
|
|
#[OneToOne(mappedBy: 'playedGame', cascade: ['persist'])]
|
|
private ?Grid $grid = null;
|
|
|
|
#[ManyToOne]
|
|
#[JoinColumn(name: 'red_id', referencedColumnName: 'id', nullable: true)]
|
|
private ?User $red = null;
|
|
|
|
#[ManyToOne]
|
|
#[JoinColumn(name: 'red_anon', referencedColumnName: 'id', nullable: true)]
|
|
private ?Gamer $redAnon = null;
|
|
|
|
#[ManyToOne]
|
|
#[JoinColumn(name: 'blue_id', referencedColumnName: 'id', nullable: true)]
|
|
private ?User $blue = null;
|
|
|
|
#[ManyToOne]
|
|
#[JoinColumn(name: 'blue_anon', referencedColumnName: 'id', nullable: true)]
|
|
private ?Gamer $blueAnon = null;
|
|
|
|
#[OneToMany(mappedBy: 'playedGame', targetEntity: Step::class)]
|
|
private Collection $steps;
|
|
|
|
|
|
public function __construct()
|
|
{
|
|
$this->steps = new ArrayCollection();
|
|
$this->uuid = Uuid::v4();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getUuid(): ?Uuid
|
|
{
|
|
return $this->uuid;
|
|
}
|
|
|
|
public function setUuid(?Uuid $uuid): void
|
|
{
|
|
$this->uuid = $uuid;
|
|
}
|
|
|
|
public function getGameAssoc(): ?string
|
|
{
|
|
return $this->gameAssoc;
|
|
}
|
|
|
|
public function setGameAssoc(?string $gameAssoc): void
|
|
{
|
|
$this->gameAssoc = $gameAssoc;
|
|
}
|
|
|
|
public function getGrid(): ?Grid
|
|
{
|
|
return $this->grid;
|
|
}
|
|
|
|
public function setGrid(?Grid $grid): void
|
|
{
|
|
$this->grid = $grid;
|
|
}
|
|
|
|
public function getRed(): ?User
|
|
{
|
|
return $this->red;
|
|
}
|
|
|
|
public function setRed(?User $red): void
|
|
{
|
|
$this->red = $red;
|
|
}
|
|
|
|
public function getRedAnon(): ?Gamer
|
|
{
|
|
return $this->redAnon;
|
|
}
|
|
|
|
public function setRedAnon(?Gamer $redAnon): void
|
|
{
|
|
$this->redAnon = $redAnon;
|
|
}
|
|
|
|
public function getBlue(): ?User
|
|
{
|
|
return $this->blue;
|
|
}
|
|
|
|
public function setBlue(?User $blue): void
|
|
{
|
|
$this->blue = $blue;
|
|
}
|
|
|
|
public function getBlueAnon(): ?Gamer
|
|
{
|
|
return $this->blueAnon;
|
|
}
|
|
|
|
public function setBlueAnon(?Gamer $blueAnon): void
|
|
{
|
|
$this->blueAnon = $blueAnon;
|
|
}
|
|
|
|
public function getRedPoints(): ?int
|
|
{
|
|
return $this->redPoints;
|
|
}
|
|
|
|
public function setRedPoints(?int $redPoints): void
|
|
{
|
|
$this->redPoints = $redPoints;
|
|
}
|
|
|
|
public function getBluePoints(): ?int
|
|
{
|
|
return $this->bluePoints;
|
|
}
|
|
|
|
public function setBluePoints(?int $bluePoints): void
|
|
{
|
|
$this->bluePoints = $bluePoints;
|
|
}
|
|
|
|
public function getRedExplodedBomb(): ?bool
|
|
{
|
|
return $this->redExplodedBomb;
|
|
}
|
|
|
|
public function setRedExplodedBomb(?bool $redExplodedBomb): void
|
|
{
|
|
$this->redExplodedBomb = $redExplodedBomb;
|
|
}
|
|
|
|
public function getBlueExplodedBomb(): ?bool
|
|
{
|
|
return $this->blueExplodedBomb;
|
|
}
|
|
|
|
public function setBlueExplodedBomb(?bool $blueExplodedBomb): void
|
|
{
|
|
$this->blueExplodedBomb = $blueExplodedBomb;
|
|
}
|
|
|
|
public function getResign(): ?string
|
|
{
|
|
return $this->resign;
|
|
}
|
|
|
|
public function setResign(?string $resign): void
|
|
{
|
|
$this->resign = $resign;
|
|
}
|
|
|
|
public function getCreated(): ?DateTime
|
|
{
|
|
return $this->created;
|
|
}
|
|
|
|
public function setCreated(?DateTime $created): void
|
|
{
|
|
$this->created = $created;
|
|
}
|
|
|
|
public function getUpdated(): ?DateTime
|
|
{
|
|
return $this->updated;
|
|
}
|
|
|
|
public function setUpdated(?DateTime $updated): void
|
|
{
|
|
$this->updated = $updated;
|
|
}
|
|
|
|
public function getSteps(): Collection
|
|
{
|
|
return $this->steps;
|
|
}
|
|
}
|