<?phpnamespace App\Entity\Game\WordSearch;use App\Repository\Game\WordSearch\WordSearchGameRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use JMS\Serializer\Annotation as Serializer;/** * @ORM\Entity(repositoryClass=WordSearchGameRepository::class) */class WordSearchGame{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $title; /** * @ORM\OneToMany(targetEntity=WordSearchLevel::class, mappedBy="game") * @Serializer\Expose * @Serializer\Groups({"game_details"}) */ private $levels; /** * @ORM\Column(type="boolean") */ private $isPublished = false; public function __construct() { $this->levels = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } /** * @return Collection<int, WordSearchLevel> */ public function getLevels(): Collection { return $this->levels; } public function addLevel(WordSearchLevel $level): self { if (!$this->levels->contains($level)) { $this->levels[] = $level; $level->setGame($this); } return $this; } public function removeLevel(WordSearchLevel $level): self { if ($this->levels->removeElement($level)) { // set the owning side to null (unless already changed) if ($level->getGame() === $this) { $level->setGame(null); } } return $this; } public function isIsPublished(): ?bool { return $this->isPublished; } public function setIsPublished(bool $isPublished): self { $this->isPublished = $isPublished; return $this; }}