src/Entity/CategorieRealisation.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CategorieRealisationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Ignore;
  8. /**
  9. * @ORM\Entity(repositoryClass=CategorieRealisationRepository::class)
  10. */
  11. class CategorieRealisation
  12. {
  13. /**
  14. * @ORM\Id
  15. * @ORM\GeneratedValue
  16. * @ORM\Column(type="integer")
  17. */
  18. private $id;
  19. /**
  20. * @ORM\Column(type="string", length=255)
  21. */
  22. private $titre;
  23. /**
  24. * @ORM\OneToMany(targetEntity=Realisation::class, mappedBy="type")
  25. * @Ignore()
  26. *
  27. */
  28. private $realisations;
  29. public function __construct()
  30. {
  31. $this->realisations = new ArrayCollection();
  32. }
  33. public function getId(): ?int
  34. {
  35. return $this->id;
  36. }
  37. public function getTitre(): ?string
  38. {
  39. return $this->titre;
  40. }
  41. public function setTitre(string $titre): self
  42. {
  43. $this->titre = $titre;
  44. return $this;
  45. }
  46. /**
  47. * @return Collection|Realisation[]
  48. */
  49. public function getRealisations(): Collection
  50. {
  51. return $this->realisations;
  52. }
  53. public function addRealisation(Realisation $realisation): self
  54. {
  55. if (!$this->realisations->contains($realisation)) {
  56. $this->realisations[] = $realisation;
  57. $realisation->setType($this);
  58. }
  59. return $this;
  60. }
  61. public function removeRealisation(Realisation $realisation): self
  62. {
  63. if ($this->realisations->removeElement($realisation)) {
  64. // set the owning side to null (unless already changed)
  65. if ($realisation->getType() === $this) {
  66. $realisation->setType(null);
  67. }
  68. }
  69. return $this;
  70. }
  71. public function __toString() : string
  72. {
  73. return $this->titre;
  74. }
  75. }