src/Entity/Empresa.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ArrayAccess;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9. * @ORM\Entity
  10. * @ORM\Table(name="empresa")
  11. */
  12. class Empresa extends Entidad implements ArrayAccess
  13. {
  14. /**
  15. * @ORM\Column(type="string", nullable=true, name="numero_trabajadores")
  16. */
  17. private $numeroTrabajadores;
  18. /**
  19. * @ORM\OneToMany(targetEntity=\App\Entity\Participante::class, mappedBy="empresa")
  20. */
  21. protected $trabajadores;
  22. /**
  23. * @ORM\OneToMany(targetEntity=\App\Entity\EmpresaPropietarioContenido::class, mappedBy="empresa")
  24. */
  25. private $empresaPropietarioContenidos;
  26. public function __construct()
  27. {
  28. $this->trabajadores = new ArrayCollection();
  29. $this->empresaPropietarioContenidos = new ArrayCollection();
  30. }
  31. /**
  32. * @return Collection<int, Participante>
  33. */
  34. public function getTrabajadores(): Collection
  35. {
  36. return $this->trabajadores;
  37. }
  38. public function addTrabajadore(Participante $trabajadore): static
  39. {
  40. if (!$this->trabajadores->contains($trabajadore)) {
  41. $this->trabajadores->add($trabajadore);
  42. $trabajadore->setEmpresa($this);
  43. }
  44. return $this;
  45. }
  46. public function removeTrabajadore(Participante $trabajadore): static
  47. {
  48. if ($this->trabajadores->removeElement($trabajadore)) {
  49. // set the owning side to null (unless already changed)
  50. if ($trabajadore->getEmpresa() === $this) {
  51. $trabajadore->setEmpresa(null);
  52. }
  53. }
  54. return $this;
  55. }
  56. public function getNumeroTrabajadores(): ?string
  57. {
  58. return $this->numeroTrabajadores;
  59. }
  60. public function setNumeroTrabajadores(?string $numeroTrabajadores): static
  61. {
  62. $this->numeroTrabajadores = $numeroTrabajadores;
  63. return $this;
  64. }
  65. /**
  66. * @return Collection<int, EmpresaPropietarioContenido>
  67. */
  68. public function getEmpresaPropietarioContenidos(): Collection
  69. {
  70. return $this->empresaPropietarioContenidos;
  71. }
  72. public function addEmpresaPropietarioContenido(EmpresaPropietarioContenido $empresaPropietarioContenido): static
  73. {
  74. if (!$this->empresaPropietarioContenidos->contains($empresaPropietarioContenido)) {
  75. $this->empresaPropietarioContenidos->add($empresaPropietarioContenido);
  76. $empresaPropietarioContenido->setEmpresa($this);
  77. }
  78. return $this;
  79. }
  80. public function removeEmpresaPropietarioContenido(EmpresaPropietarioContenido $empresaPropietarioContenido): static
  81. {
  82. if ($this->empresaPropietarioContenidos->removeElement($empresaPropietarioContenido)) {
  83. // set the owning side to null (unless already changed)
  84. if ($empresaPropietarioContenido->getEmpresa() === $this) {
  85. $empresaPropietarioContenido->setEmpresa(null);
  86. }
  87. }
  88. return $this;
  89. }
  90. public function offsetExists(mixed $offset): bool
  91. {
  92. return property_exists($this, $offset);
  93. }
  94. public function offsetGet(mixed $offset): mixed
  95. {
  96. return $this->$offset ?? null;
  97. }
  98. public function offsetSet(mixed $offset, mixed $value): void
  99. {
  100. $this->$offset = $value;
  101. }
  102. public function offsetUnset(mixed $offset): void
  103. {
  104. if (property_exists($this, $offset)) {
  105. unset($this->$offset);
  106. }
  107. }
  108. }