src/Entity/SexoUsuario.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SexoUsuarioRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClass: SexoUsuarioRepository::class)]
  8. class SexoUsuario
  9. {
  10. #[ORM\Id]
  11. #[ORM\GeneratedValue]
  12. #[ORM\Column(type: 'integer')]
  13. private $id;
  14. #[ORM\Column(type: 'string', length: 255)]
  15. private ?string $nombre = null;
  16. #[ORM\Column(type: 'boolean')]
  17. private bool $visible = true;
  18. #[ORM\Column(type: 'boolean')]
  19. private bool $borrado = false;
  20. #[ORM\OneToMany(targetEntity: Usuario::class, mappedBy: 'sexo')]
  21. private Collection $usuarios;
  22. #[ORM\OneToMany(targetEntity: Solicitud::class, mappedBy: 'sexo')]
  23. private Collection $solicitudes;
  24. public function __construct()
  25. {
  26. $this->usuarios = new ArrayCollection();
  27. $this->solicitudes = new ArrayCollection();
  28. }
  29. public function getId(): ?int
  30. {
  31. return $this->id;
  32. }
  33. public function getNombre(): ?string
  34. {
  35. return $this->nombre;
  36. }
  37. public function setNombre(string $nombre): self
  38. {
  39. $this->nombre = $nombre;
  40. return $this;
  41. }
  42. public function isVisible(): ?bool
  43. {
  44. return $this->visible;
  45. }
  46. public function setVisible(bool $visible): self
  47. {
  48. $this->visible = $visible;
  49. return $this;
  50. }
  51. public function isBorrado(): ?bool
  52. {
  53. return $this->borrado;
  54. }
  55. public function setBorrado(bool $borrado): self
  56. {
  57. $this->borrado = $borrado;
  58. return $this;
  59. }
  60. /**
  61. * @return Collection<int, Usuario>
  62. */
  63. public function getUsuarios(): Collection
  64. {
  65. return $this->usuarios;
  66. }
  67. public function addUsuario(Usuario $usuario): self
  68. {
  69. if (!$this->usuarios->contains($usuario)) {
  70. $this->usuarios[] = $usuario;
  71. $usuario->setSexo($this);
  72. }
  73. return $this;
  74. }
  75. public function removeUsuario(Usuario $usuario): self
  76. {
  77. // set the owning side to null (unless already changed)
  78. if ($this->usuarios->removeElement($usuario) && $usuario->getSexo() === $this) {
  79. $usuario->setSexo(null);
  80. }
  81. return $this;
  82. }
  83. /**
  84. * @return Collection<int, Solicitud>
  85. */
  86. public function getSolicitudes(): Collection
  87. {
  88. return $this->solicitudes;
  89. }
  90. public function addSolicitude(Solicitud $solicitude): self
  91. {
  92. if (!$this->solicitudes->contains($solicitude)) {
  93. $this->solicitudes[] = $solicitude;
  94. $solicitude->setSexo($this);
  95. }
  96. return $this;
  97. }
  98. public function removeSolicitude(Solicitud $solicitude): self
  99. {
  100. // set the owning side to null (unless already changed)
  101. if ($this->solicitudes->removeElement($solicitude) && $solicitude->getSexo() === $this) {
  102. $solicitude->setSexo(null);
  103. }
  104. return $this;
  105. }
  106. }