diff --git a/src/Entity/ClickNCollectShipment.php b/src/Entity/ClickNCollectShipment.php index 45c93e0..6907080 100644 --- a/src/Entity/ClickNCollectShipment.php +++ b/src/Entity/ClickNCollectShipment.php @@ -22,9 +22,9 @@ trait ClickNCollectShipment { /** - * @ORM\ManyToOne(targetEntity=CoopTilleuls\SyliusClickNCollectPlugin\Entity\Location::class) + * @ORM\ManyToOne(targetEntity=\CoopTilleuls\SyliusClickNCollectPlugin\Entity\LocationInterface::class) */ - protected ?Location $location = null; + protected ?LocationInterface $location = null; /** * @ORM\Column(type="string", nullable=true) @@ -37,7 +37,7 @@ trait ClickNCollectShipment */ protected ?\DateTimeInterface $collectionTime = null; - public function getLocation(): ?Location + public function getLocation(): ?LocationInterface { return $this->location; } @@ -47,7 +47,7 @@ public function isClickNCollect(): bool return null !== $this->location && null !== $this->collectionTime; } - public function setLocation(?Location $location): void + public function setLocation(?LocationInterface $location): void { $this->location = $location; if (null !== $location && null === $this->pin && $location->isGeneratePin()) { diff --git a/src/Entity/ClickNCollectShipmentInterface.php b/src/Entity/ClickNCollectShipmentInterface.php index da6040d..4803dd8 100644 --- a/src/Entity/ClickNCollectShipmentInterface.php +++ b/src/Entity/ClickNCollectShipmentInterface.php @@ -22,9 +22,9 @@ interface ClickNCollectShipmentInterface extends ShipmentInterface { public function isClickNCollect(): bool; - public function getLocation(): ?Location; + public function getLocation(): ?LocationInterface; - public function setLocation(?Location $location): void; + public function setLocation(?LocationInterface $location): void; public function getCollectionTime(): ?\DateTimeInterface; diff --git a/src/Entity/ClickNCollectShippingMethod.php b/src/Entity/ClickNCollectShippingMethod.php index acacfde..6313b46 100644 --- a/src/Entity/ClickNCollectShippingMethod.php +++ b/src/Entity/ClickNCollectShippingMethod.php @@ -23,10 +23,13 @@ trait ClickNCollectShippingMethod { /** - * @var Collection|Location[] + * @var Collection|LocationInterface[] * - * @ORM\ManyToMany(targetEntity=\CoopTilleuls\SyliusClickNCollectPlugin\Entity\Location::class, inversedBy="shippingMethods") - * @ORM\JoinTable(name="coop_tilleuls_click_n_collect_shipping_method_location") + * @ORM\ManyToMany(targetEntity=\CoopTilleuls\SyliusClickNCollectPlugin\Entity\LocationInterface::class, inversedBy="shippingMethods") + * @ORM\JoinTable( + * name="coop_tilleuls_click_n_collect_shipping_method_location", + * inverseJoinColumns={@ORM\JoinColumn(name="location_id", onDelete="cascade")} + * ) */ protected $locations; @@ -45,7 +48,7 @@ public function getLocations(): Collection return $this->locations; } - public function addLocation(Location $location): void + public function addLocation(LocationInterface $location): void { if (!$this->locations->contains($location)) { $this->locations[] = $location; @@ -57,7 +60,7 @@ public function addLocation(Location $location): void } } - public function removeLocation(Location $location): void + public function removeLocation(LocationInterface $location): void { $this->locations->removeElement($location); $location->getShippingMethods()->removeElement($this); diff --git a/src/Entity/ClickNCollectShippingMethodInterface.php b/src/Entity/ClickNCollectShippingMethodInterface.php index f6e2a4d..b0adf55 100644 --- a/src/Entity/ClickNCollectShippingMethodInterface.php +++ b/src/Entity/ClickNCollectShippingMethodInterface.php @@ -24,11 +24,11 @@ interface ClickNCollectShippingMethodInterface extends ShippingMethodInterface public function isClickNCollect(): bool; /** - * @return Location[]|Collection + * @return LocationInterface[]|Collection */ public function getLocations(): Collection; - public function addLocation(Location $location): void; + public function addLocation(LocationInterface $location): void; - public function removeLocation(Location $location): void; + public function removeLocation(LocationInterface $location): void; }