src/Entity/Board.php line 15
<?phpnamespace App\Entity;use App\Repository\BoardRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;use Symfony\Component\Validator\Mapping\ClassMetadata;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;#[ORM\Entity(repositoryClass:BoardRepository::class)]class Board{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(type:"integer")]private $id;#[ORM\Column(type:"string", length:255)]private $public_key;#[ORM\Column(type:"string", length:255)]private $private_key;#[ORM\Column(type:"string", length:4)]private $sort_order;#[ORM\Column(type:"boolean")]private $distict;#[ORM\OneToMany(targetEntity:Score::class, mappedBy:"board", orphanRemoval:true)]private $scores;public static function loadValidatorMetadata(ClassMetadata $metadata){$metadata->addConstraint(new UniqueEntity(['fields' => 'public_key','message' => 'Dieser Name ist leider bereits vergeben',]));$metadata->addConstraint(new UniqueEntity(['fields' => 'private_key','message' => 'Dieser Schlüssel ist leider bereits vergeben',]));}public function __construct(){$this->scores = new ArrayCollection();}public function __toString(){return (string) $this->getPublicKey();}public function getId(): ?int{return $this->id;}public function getPublicKey(): ?string{return $this->public_key;}public function setPublicKey(string $public_key): self{$this->public_key = $public_key;return $this;}public function getPrivateKey(): ?string{return $this->private_key;}public function setPrivateKey(string $private_key): self{$this->private_key = $private_key;return $this;}public function getSortOrder(): ?string{return $this->sort_order;}public function setSortOrder(string $sort_order): self{$this->sort_order = $sort_order;return $this;}public function isDistict(): ?bool{return $this->distict;}public function setDistict(bool $distict): self{$this->distict = $distict;return $this;}/*** @return Collection<int, Score>*/public function getScores(): Collection{return $this->scores;}public function addScore(Score $score): self{if (!$this->scores->contains($score)) {$this->scores[] = $score;$score->setBoard($this);}return $this;}public function removeScore(Score $score): self{if ($this->scores->removeElement($score)) {// set the owning side to null (unless already changed)if ($score->getBoard() === $this) {$score->setBoard(null);}}return $this;}}