src/Entity/EstadoRecurso.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7. * @ORM\Entity
  8. */
  9. class EstadoRecurso extends \App\Entity\BaseEntity
  10. {
  11. /**
  12. * @ORM\Id
  13. * @ORM\Column(type="integer")
  14. * @ORM\GeneratedValue(strategy="AUTO")
  15. */
  16. private $id;
  17. /**
  18. * @ORM\Column(type="string", nullable=true)
  19. */
  20. private $nombre;
  21. /**
  22. * @ORM\OneToMany(targetEntity=\App\Entity\Recurso::class, mappedBy="estadoRecurso")
  23. */
  24. private $recursos;
  25. public function __construct()
  26. {
  27. $this->recursos = new ArrayCollection();
  28. }
  29. public function getId(): ?int
  30. {
  31. return $this->id;
  32. }
  33. public function setId($id)
  34. {
  35. $this->id = $id;
  36. return $this;
  37. }
  38. public function getNombre(): ?string
  39. {
  40. return $this->nombre;
  41. }
  42. public function setNombre(?string $nombre): static
  43. {
  44. $this->nombre = $nombre;
  45. return $this;
  46. }
  47. /**
  48. * @return Collection<int, Recurso>
  49. */
  50. public function getRecursos(): Collection
  51. {
  52. return $this->recursos;
  53. }
  54. public function addRecurso(Recurso $recurso): static
  55. {
  56. if (!$this->recursos->contains($recurso)) {
  57. $this->recursos->add($recurso);
  58. $recurso->setEstadoRecurso($this);
  59. }
  60. return $this;
  61. }
  62. public function removeRecurso(Recurso $recurso): static
  63. {
  64. if ($this->recursos->removeElement($recurso)) {
  65. // set the owning side to null (unless already changed)
  66. if ($recurso->getEstadoRecurso() === $this) {
  67. $recurso->setEstadoRecurso(null);
  68. }
  69. }
  70. return $this;
  71. }
  72. }