diff --git a/src/Entity/GatewayCheckout.php b/src/Entity/GatewayCheckout.php index 397b685..3127188 100644 --- a/src/Entity/GatewayCheckout.php +++ b/src/Entity/GatewayCheckout.php @@ -72,13 +72,14 @@ class GatewayCheckout private ?string $gateway = null; /** - * The IDs provided by the Gateway for this checkout. + * A list of tracking codes provided by the Gateway for this checkout.\ + * e.g: Order ID, Payment Capture ID, Checkout Session Token * - * @var Collection + * @var Collection */ #[API\ApiProperty(writable: false)] - #[ORM\OneToMany(mappedBy: 'checkout', targetEntity: GatewayCheckoutId::class, cascade: ['persist'])] - private Collection $gatewayIds; + #[ORM\OneToMany(mappedBy: 'checkout', targetEntity: GatewayTracking::class, cascade: ['persist'])] + private Collection $gatewayTrackings; /** * The URLs provided by the Gateway for this checkout. @@ -114,7 +115,7 @@ class GatewayCheckout $this->charges = new ArrayCollection(); $this->status = GatewayCheckoutStatus::Pending; $this->gatewayLinks = new ArrayCollection(); - $this->gatewayIds = new ArrayCollection(); + $this->gatewayTrackings = new ArrayCollection(); } public function getId(): ?int @@ -183,29 +184,29 @@ class GatewayCheckout } /** - * @return Collection + * @return Collection */ - public function getGatewayIds(): Collection + public function getGatewayTrackings(): Collection { - return $this->gatewayIds; + return $this->gatewayTrackings; } - public function addGatewayId(GatewayCheckoutId $gatewayId): static + public function addGatewayTracking(GatewayTracking $gatewayTracking): static { - if (!$this->gatewayIds->contains($gatewayId)) { - $this->gatewayIds->add($gatewayId); - $gatewayId->setCheckout($this); + if (!$this->gatewayTrackings->contains($gatewayTracking)) { + $this->gatewayTrackings->add($gatewayTracking); + $gatewayTracking->setCheckout($this); } return $this; } - public function removeGatewayId(GatewayCheckoutId $gatewayId): static + public function removeGatewayTracking(GatewayTracking $gatewayTracking): static { - if ($this->gatewayIds->removeElement($gatewayId)) { + if ($this->gatewayTrackings->removeElement($gatewayTracking)) { // set the owning side to null (unless already changed) - if ($gatewayId->getCheckout() === $this) { - $gatewayId->setCheckout(null); + if ($gatewayTracking->getCheckout() === $this) { + $gatewayTracking->setCheckout(null); } } diff --git a/src/Entity/GatewayCheckoutId.php b/src/Entity/GatewayTracking.php similarity index 83% rename from src/Entity/GatewayCheckoutId.php rename to src/Entity/GatewayTracking.php index ec41ffa..0799870 100644 --- a/src/Entity/GatewayCheckoutId.php +++ b/src/Entity/GatewayTracking.php @@ -2,11 +2,11 @@ namespace App\Entity; -use App\Repository\GatewayCheckoutIdRepository; +use App\Repository\GatewayTrackingRepository; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity(repositoryClass: GatewayCheckoutIdRepository::class)] -class GatewayCheckoutId +#[ORM\Entity(repositoryClass: GatewayTrackingRepository::class)] +class GatewayTracking { #[ORM\Id] #[ORM\GeneratedValue] @@ -14,13 +14,13 @@ class GatewayCheckoutId private ?int $id = null; /** - * The ID given by the Gateway. + * The tracking number given by the Gateway. */ #[ORM\Column(length: 255)] private ?string $value = null; /** - * A descriptive title for the ID type. + * A descriptive title for the tracking number. */ #[ORM\Column(length: 255)] private ?string $title = null; diff --git a/src/Repository/GatewayCheckoutIdRepository.php b/src/Repository/GatewayTrackingRepository.php similarity index 70% rename from src/Repository/GatewayCheckoutIdRepository.php rename to src/Repository/GatewayTrackingRepository.php index e46a568..f687a3f 100644 --- a/src/Repository/GatewayCheckoutIdRepository.php +++ b/src/Repository/GatewayTrackingRepository.php @@ -2,22 +2,22 @@ namespace App\Repository; -use App\Entity\GatewayCheckoutId; +use App\Entity\GatewayTracking; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; /** - * @extends ServiceEntityRepository + * @extends ServiceEntityRepository */ -class GatewayCheckoutIdRepository extends ServiceEntityRepository +class GatewayTrackingRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { - parent::__construct($registry, GatewayCheckoutId::class); + parent::__construct($registry, GatewayTracking::class); } // /** - // * @return GatewayCheckoutId[] Returns an array of GatewayCheckoutId objects + // * @return GatewayTracking[] Returns an array of GatewayTracking objects // */ // public function findByExampleField($value): array // { @@ -31,7 +31,7 @@ class GatewayCheckoutIdRepository extends ServiceEntityRepository // ; // } - // public function findOneBySomeField($value): ?GatewayCheckoutId + // public function findOneBySomeField($value): ?GatewayTracking // { // return $this->createQueryBuilder('g') // ->andWhere('g.exampleField = :val')