|
1234567891011121314151617181920212223242526272829 |
- <?php
-
- namespace Lc\CaracoleBundle\Factory\Order;
-
- use Lc\CaracoleBundle\Container\Order\OrderPaymentContainer;
- use Lc\CaracoleBundle\Model\Order\OrderPaymentInterface;
- use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
- use Lc\SovBundle\Factory\AbstractFactory;
-
- class OrderPaymentFactory extends AbstractFactory
- {
- public function create(OrderShopInterface $orderShop, string $meanPayment, float $amount, bool $editable = false): OrderPaymentInterface
- {
- $orderPayment = $this->createBase($orderShop);
- $orderPayment->setMeanPayment($meanPayment);
- $orderPayment->setAmount($amount);
- $orderPayment->setPaidAt(new \DateTime());
- $orderPayment->setEditable($editable);
-
- return $orderPayment;
- }
-
- public function createBase($orderShop){
- $class = OrderPaymentContainer::getEntityFqcn();
- $orderPayment = new $class;
- $orderPayment->setOrderShop($orderShop);
- return $orderPayment;
- }
- }
|