src/Entity/TipoCiclo.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TipoCicloRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=TipoCicloRepository::class)
  9. */
  10. class TipoCiclo
  11. {
  12. /**
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\Column(type="string", length=100)
  20. */
  21. private $nombre;
  22. /**
  23. * @ORM\Column(type="integer")
  24. */
  25. private $duracionMeses;
  26. /**
  27. * @ORM\OneToMany(targetEntity=Ciclo::class, mappedBy="tipoCiclo")
  28. */
  29. private $ciclos;
  30. public function __construct()
  31. {
  32. $this->ciclos = new ArrayCollection();
  33. }
  34. public function getId(): ?int
  35. {
  36. return $this->id;
  37. }
  38. public function getNombre(): ?string
  39. {
  40. return $this->nombre;
  41. }
  42. public function setNombre(string $nombre): self
  43. {
  44. $this->nombre = $nombre;
  45. return $this;
  46. }
  47. public function getDuracionMeses(): ?int
  48. {
  49. return $this->duracionMeses;
  50. }
  51. public function setDuracionMeses(int $duracionMeses): self
  52. {
  53. $this->duracionMeses = $duracionMeses;
  54. return $this;
  55. }
  56. /**
  57. * @return Collection<int, Ciclo>
  58. */
  59. public function getCiclos(): Collection
  60. {
  61. return $this->ciclos;
  62. }
  63. public function addCiclo(Ciclo $ciclo): self
  64. {
  65. if (!$this->ciclos->contains($ciclo)) {
  66. $this->ciclos[] = $ciclo;
  67. $ciclo->setTipoCiclo($this);
  68. }
  69. return $this;
  70. }
  71. public function removeCiclo(Ciclo $ciclo): self
  72. {
  73. if ($this->ciclos->removeElement($ciclo)) {
  74. // set the owning side to null (unless already changed)
  75. if ($ciclo->getTipoCiclo() === $this) {
  76. $ciclo->setTipoCiclo(null);
  77. }
  78. }
  79. return $this;
  80. }
  81. }