Advertisement
Guest User

Transaction.php

a guest
Jan 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. <?php
  2. // src/App/Entity
  3. namespace App\Entity;
  4.  
  5. use Beelab\PaypalBundle\Entity\Transaction as BaseTransaction;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9.  
  10. /**
  11. * @ORM\Table()
  12. * @ORM\Entity()
  13. */
  14. class Transaction extends BaseTransaction
  15. {
  16. // if you need other properties, or relationships, add them here...
  17.  
  18. /**
  19. * @ORM\Column(type="text", nullable=TRUE)
  20. */
  21. protected $description;
  22.  
  23.  
  24.  
  25. /**
  26. *
  27. * @ORM\OneToMany(targetEntity="Item", mappedBy="transaction")
  28. */
  29. protected $items;
  30.  
  31. public function __construct() {
  32. $this->items=new ArrayCollection();
  33. }
  34.  
  35.  
  36. /**
  37. * @ORM\Column(type="float", nullable=TRUE)
  38. */
  39. private $shippingAmount;
  40.  
  41. public function getDescription(): ?string
  42. {
  43. return $this->description;
  44. }
  45.  
  46. public function setDescription(?string $description): self
  47. {
  48. $this->description = $description;
  49.  
  50. return $this;
  51. }
  52.  
  53. public function getShippingAmount(): string
  54. {
  55. return '';
  56. }
  57.  
  58. public function setShippingAmount(?float $shippingAmount): self
  59. {
  60. $this->shippingAmount = $shippingAmount;
  61.  
  62. return $this;
  63. }
  64.  
  65.  
  66. public function getItems(): array
  67. {
  68. return [];
  69. }
  70.  
  71. public function addItem(Item $item): self
  72. {
  73. if (!$this->items->contains($item)) {
  74. $this->items[] = $item;
  75. $item->setTransaction($this);
  76. }
  77.  
  78. return $this;
  79. }
  80.  
  81. public function removeItem(Item $item): self
  82. {
  83. if ($this->items->contains($item)) {
  84. $this->items->removeElement($item);
  85. // set the owning side to null (unless already changed)
  86. if ($item->getTransaction() === $this) {
  87. $item->setTransaction(null);
  88. }
  89. }
  90.  
  91. return $this;
  92. }
  93.  
  94.  
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement