Creating a WHRelayCart entity to save our chosen relay points
We saw in a previous section that we decided to store the relay points data directly in the module’s code. Even if it could have been stored in the database, it is much simpler to explain the other concepts of this module without putting too many entities inside it.
Let’s focus on how to store the relay point corresponding to each cart/order. The best way to do it is by creating a new Doctrine
entity named WHRelayCart
made of three columns:
id_relay_cart
(index)id_cart
id_relay
This will enable us to do the matching.
This entity can be created directly in the /modules/whrelaycarrier/src/Entity/WHRelayCart.php
file containing the following code:
<?php namespace WebHelpers\WHRelayCarrier\Entity; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Table(name="ps_whrelaycarrier_relay_cart") * @ORM\Entity(repositoryClass="WebHelpers\WHRelayCarrier\Repository\WHRelayCartRepository...