vendor/croisiland/common-bundle/src/Entity/Itinerary/DestinationSecondary.php line 19

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Croisiland\CommonBundle\Entity\Itinerary;
  4. use Croisiland\CommonBundle\Annotation\Itinerary\ItineraryDestinationSecondaryFormValidator;
  5. use Croisiland\CommonBundle\Entity\Correspondence\DestinationCorrespondence;
  6. use Croisiland\CommonBundle\Repository\Itinerary\DestinationSecondaryRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * @ItineraryDestinationSecondaryFormValidator(groups="itinerary_destination_secondary_form_validator")
  12. *
  13. * @ORM\Entity(repositoryClass=DestinationSecondaryRepository::class)
  14. */
  15. class DestinationSecondary extends Destination
  16. {
  17. /**
  18. * @ORM\ManyToOne(targetEntity=DestinationMain::class, inversedBy="secondaryDestinations")
  19. */
  20. private ?DestinationMain $mainDestination = null;
  21. /**
  22. * @var Collection<int, ItinerarySecondaryDestination>
  23. *
  24. * @ORM\OneToMany(targetEntity=ItinerarySecondaryDestination::class, mappedBy="secondaryDestination", orphanRemoval=true)
  25. */
  26. private $itineraryRelations;
  27. /**
  28. * @var Collection<int, DestinationCorrespondence>
  29. *
  30. * @ORM\OneToMany(targetEntity=DestinationCorrespondence::class, mappedBy="destinationSecondary", orphanRemoval=true)
  31. */
  32. private $destinationCorrespondences;
  33. /**
  34. * @ORM\OneToOne(targetEntity=DestinationSecondaryComputed::class, mappedBy="destinationSecondary")
  35. */
  36. private ?DestinationSecondaryComputed $computed = null;
  37. public function __construct()
  38. {
  39. parent::__construct();
  40. $this->itineraryRelations = new ArrayCollection();
  41. }
  42. public function getMainDestination(): ?DestinationMain
  43. {
  44. return $this->mainDestination;
  45. }
  46. public function setMainDestination(?DestinationMain $mainDestination): self
  47. {
  48. $this->mainDestination = $mainDestination;
  49. return $this;
  50. }
  51. /**
  52. * @return Collection<int, ItinerarySecondaryDestination>
  53. */
  54. public function getItineraryRelations(): Collection
  55. {
  56. return $this->itineraryRelations;
  57. }
  58. public function addItineraryRelation(ItinerarySecondaryDestination $itineraryRelation): self
  59. {
  60. if (!$this->itineraryRelations->contains($itineraryRelation)) {
  61. $this->itineraryRelations[] = $itineraryRelation;
  62. $itineraryRelation->setSecondaryDestination($this);
  63. }
  64. return $this;
  65. }
  66. public function removeItineraryRelation(ItinerarySecondaryDestination $itineraryRelation): self
  67. {
  68. if ($this->itineraryRelations->removeElement($itineraryRelation)) {
  69. // set the owning side to null (unless already changed)
  70. if ($itineraryRelation->getSecondaryDestination() === $this) {
  71. $itineraryRelation->setSecondaryDestination(null);
  72. }
  73. }
  74. return $this;
  75. }
  76. /**
  77. * @return Collection<int, DestinationCorrespondence>
  78. */
  79. public function getDestinationCorrespondences(): Collection
  80. {
  81. return $this->destinationCorrespondences;
  82. }
  83. public function addDestinationCorrespondence(DestinationCorrespondence $destinationCorrespondence): self
  84. {
  85. if (!$this->destinationCorrespondences->contains($destinationCorrespondence)) {
  86. $this->destinationCorrespondences[] = $destinationCorrespondence;
  87. $destinationCorrespondence->setDestinationSecondary($this);
  88. }
  89. return $this;
  90. }
  91. public function removeDestinationCorrespondence(DestinationCorrespondence $destinationCorrespondence): self
  92. {
  93. if ($this->destinationCorrespondences->removeElement($destinationCorrespondence)) {
  94. // set the owning side to null (unless already changed)
  95. if ($destinationCorrespondence->getDestinationSecondary() === $this) {
  96. $destinationCorrespondence->setDestinationSecondary(null);
  97. }
  98. }
  99. return $this;
  100. }
  101. public function getComputed(): ?DestinationSecondaryComputed
  102. {
  103. return $this->computed;
  104. }
  105. public function setComputed(?DestinationSecondaryComputed $computed): DestinationSecondary
  106. {
  107. $this->computed = $computed;
  108. return $this;
  109. }
  110. }