src/Entity/EstadoAlumno.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EstadoAlumnoRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClass: EstadoAlumnoRepository::class)]
  8. class EstadoAlumno
  9. {
  10. #[ORM\Id]
  11. #[ORM\GeneratedValue]
  12. #[ORM\Column]
  13. private ?int $id = null;
  14. #[ORM\Column(length: 255)]
  15. private ?string $nombre = null;
  16. #[ORM\Column]
  17. private bool $visible = true;
  18. #[ORM\Column]
  19. private bool $borrado = false;
  20. #[ORM\OneToMany(mappedBy: 'estado', targetEntity: Alumno::class)]
  21. private Collection $alumnos;
  22. public function __construct()
  23. {
  24. $this->alumnos = new ArrayCollection();
  25. }
  26. public function getId(): ?int
  27. {
  28. return $this->id;
  29. }
  30. public function getNombre(): ?string
  31. {
  32. return $this->nombre;
  33. }
  34. public function setNombre(string $nombre): static
  35. {
  36. $this->nombre = $nombre;
  37. return $this;
  38. }
  39. public function isVisible(): ?bool
  40. {
  41. return $this->visible;
  42. }
  43. public function setVisible(bool $visible): static
  44. {
  45. $this->visible = $visible;
  46. return $this;
  47. }
  48. public function isBorrado(): ?bool
  49. {
  50. return $this->borrado;
  51. }
  52. public function setBorrado(bool $borrado): static
  53. {
  54. $this->borrado = $borrado;
  55. return $this;
  56. }
  57. /**
  58. * @return Collection<int, Alumno>
  59. */
  60. public function getAlumnos(): Collection
  61. {
  62. return $this->alumnos;
  63. }
  64. public function addAlumno(Alumno $alumno): static
  65. {
  66. if (!$this->alumnos->contains($alumno)) {
  67. $this->alumnos->add($alumno);
  68. $alumno->setEstado($this);
  69. }
  70. return $this;
  71. }
  72. public function removeAlumno(Alumno $alumno): static
  73. {
  74. if ($this->alumnos->removeElement($alumno)) {
  75. // set the owning side to null (unless already changed)
  76. if ($alumno->getEstado() === $this) {
  77. $alumno->setEstado(null);
  78. }
  79. }
  80. return $this;
  81. }
  82. }