src/Core/Entity/Agenda.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Core\Entity;
  3. use App\Core\Repository\AgendaRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Doctrine\ORM\Mapping\OrderBy;
  8. /**
  9. * @ORM\Entity(repositoryClass=AgendaRepository::class)
  10. */
  11. class Agenda
  12. {
  13. /**
  14. * @ORM\Id()
  15. * @ORM\GeneratedValue()
  16. * @ORM\Column(type="integer")
  17. */
  18. private $id;
  19. /**
  20. * @ORM\OneToMany(targetEntity=RecordatorioAgenda::class, mappedBy="agenda", orphanRemoval=true)
  21. * @OrderBy({"fecha" = "ASC"})
  22. */
  23. private $recordatoriosAgenda;
  24. public function __construct()
  25. {
  26. $this->recordatoriosAgenda = new ArrayCollection();
  27. }
  28. public function getId(): ?int
  29. {
  30. return $this->id;
  31. }
  32. /**
  33. * @return Collection|RecordatorioAgenda[]
  34. */
  35. public function getRecordatoriosAgenda(): Collection
  36. {
  37. return $this->recordatoriosAgenda;
  38. }
  39. public function addRecordatoriosAgenda(RecordatorioAgenda $recordatoriosAgenda): self
  40. {
  41. if (!$this->recordatoriosAgenda->contains($recordatoriosAgenda)) {
  42. $this->recordatoriosAgenda[] = $recordatoriosAgenda;
  43. $recordatoriosAgenda->setAgenda($this);
  44. }
  45. return $this;
  46. }
  47. public function removeRecordatoriosAgenda(RecordatorioAgenda $recordatoriosAgenda): self
  48. {
  49. if ($this->recordatoriosAgenda->contains($recordatoriosAgenda)) {
  50. $this->recordatoriosAgenda->removeElement($recordatoriosAgenda);
  51. // set the owning side to null (unless already changed)
  52. if ($recordatoriosAgenda->getAgenda() === $this) {
  53. $recordatoriosAgenda->setAgenda(null);
  54. }
  55. }
  56. return $this;
  57. }
  58. }