From e279eb33d81f1e5e085001a6c391375f615ff64c Mon Sep 17 00:00:00 2001 From: MAde Date: Fri, 22 Sep 2017 11:15:53 +0200 Subject: [PATCH] Add getter and setter for mangoId in Transaction Put executedDate to nullable false to avoid error if transaction have failded and not be executed add cascade persist on payinId to allow persist from contribution entity --- Entity/Order.php | 8 ++++---- Entity/Transaction.php | 27 +++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Entity/Order.php b/Entity/Order.php index 04dce56..e7ab5fc 100644 --- a/Entity/Order.php +++ b/Entity/Order.php @@ -55,9 +55,9 @@ class Order protected $status; /** - * @var string + * @var Transaction * - * @ORM\OneToOne(targetEntity="Troopers\MangopayBundle\Entity\Transaction", cascade={"remove"}) + * @ORM\OneToOne(targetEntity="Troopers\MangopayBundle\Entity\Transaction", cascade={"persist", "remove"}) */ protected $payinTransaction; @@ -113,7 +113,7 @@ public function getStatus() /** * Set payinTransaction. * - * @param int $payinTransaction + * @param Transaction $payinTransaction * * @return Order */ @@ -127,7 +127,7 @@ public function setPayinTransaction($payinTransaction) /** * Get payinTransaction. * - * @return int + * @return Transaction */ public function getPayinTransaction() { diff --git a/Entity/Transaction.php b/Entity/Transaction.php index 7e904b1..60b12de 100644 --- a/Entity/Transaction.php +++ b/Entity/Transaction.php @@ -24,6 +24,11 @@ class Transaction implements TransactionInterface */ protected $id; + /** + * @var int + */ + protected $mangoId; + /** * Author Id. * @@ -100,7 +105,7 @@ class Transaction implements TransactionInterface * Execution date;. * * @var \DateTime - * @ORM\Column(name="executionDate", type="datetime") + * @ORM\Column(name="executionDate", type="datetime", nullable=true) */ protected $executionDate; @@ -124,7 +129,7 @@ class Transaction implements TransactionInterface * CardType { CB_VISA_MASTERCARD, MAESTRO, DINERS, P24″, MASTERPASS }. * * @var string - * @ORM\Column(name="cardType", type="string", length=255) + * @ORM\Column(name="cardType", type="string", length=255, nullable=true) */ protected $cardType; @@ -138,6 +143,24 @@ protected function getId() return $this->id; } + /** + * @return int + */ + public function getMangoId() + { + return $this->mangoId; + } + + /** + * @param int $mangoId + * @return Transaction + */ + public function setMangoId($mangoId) + { + $this->mangoId = $mangoId; + return $this; + } + /** * Get authorId. *