<?phpnamespace App\Entity\Game\Riddle;use App\Entity\BaseEntity;use App\Entity\Game\Riddle\WordRiddleParticipation;use App\Repository\Game\Riddle\WordRiddleRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use JMS\Serializer\Annotation as Serializer;use Gedmo\Mapping\Annotation as Gedmo;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;/** * @ORM\Entity(repositoryClass=WordRiddleRepository::class) * @Serializer\ExclusionPolicy("ALL") * @UniqueEntity( * fields={"name"}, * errorPath="name", * message="Un jeu existe avec le même nom" * ) */class WordRiddle extends BaseEntity{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") * @Serializer\Expose * @Serializer\Groups({"word_riddle_list"}) */ private $id; /** * @ORM\Column(type="text") * @Serializer\Expose * @Serializer\Groups({"word_riddle_list"}) */ private $clue; /** * @ORM\Column(type="string", length=255) * @Serializer\Expose * @Serializer\Groups({"word_riddle_list"}) */ private $word; /** * @ORM\Column(type="integer", nullable=true) * @Serializer\Expose * @Serializer\Groups({"word_riddle_list"}) */ private $numberOfAttempts; /** * @Gedmo\Slug(fields={"name"}) * @ORM\Column(length=191) */ private $slug; /** * @ORM\Column(type="string", length=255) * @Serializer\Expose * @Serializer\Groups({"word_riddle_list"}) */ private $name; /** * @ORM\Column(type="boolean") */ private $isPublished = true; /** * @Serializer\Expose * @Serializer\Groups({"word_riddle_list"}) */ private $letters; /** * @ORM\Column(type="integer", nullable=true) */ private $point = 0; /** * @ORM\OneToMany(targetEntity=WordRiddleParticipation::class, mappedBy="wordRiddle", cascade={"remove"}) */ private $wordRiddleParticipations; public function __construct() { $this->wordRiddleParticipations = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getClue(): ?string { return $this->clue; } public function setClue(string $clue): self { $this->clue = $clue; return $this; } public function getWord(): ?string { return $this->word; } public function setWord(string $word): self { $this->word = $word; return $this; } public function getNumberOfAttempts(): ?int { return $this->numberOfAttempts; } public function setNumberOfAttempts(?int $numberOfAttempts): self { $this->numberOfAttempts = $numberOfAttempts; return $this; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } /** * Get the value of slug */ public function getSlug() { return $this->slug; } /** * Set the value of slug * * @return self */ public function setSlug($slug) { $this->slug = $slug; return $this; } public function isIsPublished(): ?bool { return $this->isPublished; } public function setIsPublished(bool $isPublished): self { $this->isPublished = $isPublished; return $this; } public function getLetters(): ?array { return $this->letters; } public function setLetters(?array $letters): self { $this->letters = $letters; return $this; } public function getPoint(): ?int { return $this->point; } public function setPoint(?int $point): self { $this->point = $point; return $this; } /** * @return Collection<int, WordRiddleParticipation> */ public function getWordRiddleParticipations(): Collection { return $this->wordRiddleParticipations; } public function addWordRiddleParticipation(WordRiddleParticipation $wordRiddleParticipation): self { if (!$this->wordRiddleParticipations->contains($wordRiddleParticipation)) { $this->wordRiddleParticipations[] = $wordRiddleParticipation; $wordRiddleParticipation->setWordRiddle($this); } return $this; } public function removeWordRiddleParticipation(WordRiddleParticipation $wordRiddleParticipation): self { if ($this->wordRiddleParticipations->removeElement($wordRiddleParticipation)) { // set the owning side to null (unless already changed) if ($wordRiddleParticipation->getWordRiddle() === $this) { $wordRiddleParticipation->setWordRiddle(null); } } return $this; }}