src/Core/Entity/Institucion/Director.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Core\Entity\Institucion;
  3. use App\Core\Entity\User;
  4. use App\Core\Repository\Institucion\DirectorRepository;
  5. use App\Core\Entity\Institucion\DirectorInstitucion;
  6. use App\Entity\InvitacionInstitucion;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * @ORM\Entity(repositoryClass=DirectorRepository::class)
  12. */
  13. class Director
  14. {
  15. /**
  16. * @ORM\Id
  17. * @ORM\GeneratedValue
  18. * @ORM\Column(type="integer")
  19. */
  20. private $id;
  21. /**
  22. * @ORM\OneToOne(targetEntity=User::class, inversedBy="director", cascade={"persist", "remove"})
  23. * @ORM\JoinColumn(nullable=false)
  24. */
  25. private $usuario;
  26. /**
  27. * @ORM\OneToMany(targetEntity=DirectorInstitucion::class, mappedBy="director")
  28. */
  29. private $directorInstituciones;
  30. /**
  31. * @ORM\OneToMany(targetEntity=InvitacionInstitucion::class, mappedBy="director")
  32. */
  33. private $invitacionInstitucions;
  34. public function __construct()
  35. {
  36. $this->directorInstituciones = new ArrayCollection();
  37. $this->invitacionInstitucions = new ArrayCollection();
  38. }
  39. public function getId(): ?int
  40. {
  41. return $this->id;
  42. }
  43. public function getUser(): ?User
  44. {
  45. return $this->usuario;
  46. }
  47. public function setUser(User $usuario): self
  48. {
  49. $this->usuario = $usuario;
  50. return $this;
  51. }
  52. /**
  53. * @return Collection|DirectorInstitucion[]
  54. */
  55. public function getDirectorInstituciones(): Collection
  56. {
  57. return $this->directorInstituciones;
  58. }
  59. public function addDirectorInstitucione(DirectorInstitucion $directorInstitucione): self
  60. {
  61. if (!$this->directorInstituciones->contains($directorInstitucione)) {
  62. $this->directorInstituciones[] = $directorInstitucione;
  63. $directorInstitucione->setDirector($this);
  64. }
  65. return $this;
  66. }
  67. public function removeDirectorInstitucione(DirectorInstitucion $directorInstitucione): self
  68. {
  69. if ($this->directorInstituciones->removeElement($directorInstitucione)) {
  70. // set the owning side to null (unless already changed)
  71. if ($directorInstitucione->getDirector() === $this) {
  72. $directorInstitucione->setDirector(null);
  73. }
  74. }
  75. return $this;
  76. }
  77. /**
  78. * @return Collection<int, InvitacionInstitucion>
  79. */
  80. public function getInvitacionInstitucions(): Collection
  81. {
  82. return $this->invitacionInstitucions;
  83. }
  84. public function addInvitacionInstitucion(InvitacionInstitucion $invitacionInstitucion): self
  85. {
  86. if (!$this->invitacionInstitucions->contains($invitacionInstitucion)) {
  87. $this->invitacionInstitucions[] = $invitacionInstitucion;
  88. $invitacionInstitucion->setDirector($this);
  89. }
  90. return $this;
  91. }
  92. public function removeInvitacionInstitucion(InvitacionInstitucion $invitacionInstitucion): self
  93. {
  94. if ($this->invitacionInstitucions->removeElement($invitacionInstitucion)) {
  95. // set the owning side to null (unless already changed)
  96. if ($invitacionInstitucion->getDirector() === $this) {
  97. $invitacionInstitucion->setDirector(null);
  98. }
  99. }
  100. return $this;
  101. }
  102. }