src\Entity\Theme.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Repository\ThemeRepository;
  7. #[ORM\Entity(repositoryClass: ThemeRepository::class)]
  8. #[ORM\Table(name: '`theme`')]
  9. class Theme {
  10. #[ORM\Id]
  11. #[ORM\GeneratedValue]
  12. #[ORM\Column]
  13. private ?int $theme_id = null;
  14. #[ORM\Column(type:"string",length: 50)]
  15. private ?string $libelle = null;
  16. #[ORM\OneToMany(targetEntity: ProposeTheme::class, mappedBy: 'theme_id', orphanRemoval: true, cascade: ['persist'])]
  17. private Collection $proposetheme;
  18. public function __construct()
  19. {
  20. $this->proposetheme = new ArrayCollection();
  21. }
  22. public function getThemeId(): ?int
  23. {
  24. return $this->theme_id;
  25. }
  26. public function setThemeId(int $theme_id): static
  27. {
  28. $this->theme_id = $theme_id;
  29. return $this;
  30. }
  31. public function getLibelle(): ?string
  32. {
  33. return $this->libelle;
  34. }
  35. public function setLibelle(string $libelle): static
  36. {
  37. $this->libelle = $libelle;
  38. return $this;
  39. }
  40. /**
  41. * @return Collection<int, ProposeTheme>
  42. */
  43. public function getProposeThemes(): Collection
  44. {
  45. return $this->proposetheme;
  46. }
  47. public function addProposeTheme(ProposeTheme $proposetheme): static
  48. {
  49. if (!$this->proposetheme->contains($proposetheme)) {
  50. $this->proposetheme->add($proposetheme);
  51. $proposetheme->setThemeId($this);
  52. }
  53. return $this;
  54. }
  55. public function removeProposeTheme(ProposeTheme $proposetheme): static
  56. {
  57. if ($this->proposetheme->removeElement($proposetheme)) {
  58. // set the owning side to null (unless already changed)
  59. if ($proposetheme->getThemeId() === $this) {
  60. $proposetheme->setThemeId(null);
  61. }
  62. }
  63. return $this;
  64. }
  65. }