src/Entity/Counterparty.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Bundles\Instruments\Base\Entity\Forward;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Repository\CounterpartyRepository;
  8. /**
  9. * @ORM\Entity(repositoryClass=CounterpartyRepository::class)
  10. */
  11. class Counterparty
  12. {
  13. /**
  14. * @ORM\Id
  15. * @ORM\GeneratedValue
  16. * @ORM\Column(type="integer")
  17. */
  18. private $id;
  19. /**
  20. * @ORM\Column(type="string", length=255)
  21. */
  22. private $name;
  23. /**
  24. * @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="counterparties")
  25. * @ORM\JoinColumn(nullable=false)
  26. */
  27. private $Customer;
  28. /**
  29. * @ORM\Column(type="integer")
  30. */
  31. private $creditLimit;
  32. /**
  33. * @ORM\Column(type="string", length=5)
  34. */
  35. private $currency;
  36. /**
  37. * @ORM\Column(type="boolean", nullable=true)
  38. */
  39. private $status;
  40. /**
  41. * @ORM\Column(type="integer", nullable=true)
  42. */
  43. private $otm1;
  44. /**
  45. * @ORM\Column(type="integer", nullable=true)
  46. */
  47. private $otm2;
  48. /**
  49. * @ORM\Column(type="integer", nullable=true)
  50. */
  51. private $otm3;
  52. /**
  53. * @ORM\Column(type="integer", nullable=true)
  54. */
  55. private $variationMargin1;
  56. /**
  57. * @ORM\Column(type="integer", nullable=true)
  58. */
  59. private $variationMargin2;
  60. /**
  61. * @ORM\Column(type="integer", nullable=true)
  62. */
  63. private $variationMargin3;
  64. /**
  65. * @ORM\OneToMany(targetEntity=Forward::class, mappedBy="Counterparty")
  66. */
  67. private $trades;
  68. public function __construct()
  69. {
  70. $this->trades = new ArrayCollection();
  71. }
  72. public function getId(): ?int
  73. {
  74. return $this->id;
  75. }
  76. public function getName(): ?string
  77. {
  78. return $this->name;
  79. }
  80. public function setName(string $name): self
  81. {
  82. $this->name = $name;
  83. return $this;
  84. }
  85. public function getCustomer(): ?Customer
  86. {
  87. return $this->Customer;
  88. }
  89. public function setCustomer(?Customer $Customer): self
  90. {
  91. $this->Customer = $Customer;
  92. return $this;
  93. }
  94. public function getCreditLimit(): ?int
  95. {
  96. return $this->creditLimit;
  97. }
  98. public function setCreditLimit(int $creditLimit): self
  99. {
  100. $this->creditLimit = $creditLimit;
  101. return $this;
  102. }
  103. public function getCurrency(): ?string
  104. {
  105. return $this->currency;
  106. }
  107. public function setCurrency(string $currency): self
  108. {
  109. $this->currency = $currency;
  110. return $this;
  111. }
  112. public function getStatus(): ?bool
  113. {
  114. return $this->status;
  115. }
  116. public function setStatus(?bool $status): self
  117. {
  118. $this->status = $status;
  119. return $this;
  120. }
  121. /**
  122. * @return Collection<int>
  123. */
  124. public function getTrades(): Collection
  125. {
  126. return $this->trades;
  127. }
  128. public function addTrade($trade): self
  129. {
  130. if (!$this->trades->contains($trade)) {
  131. $this->trades[] = $trade;
  132. $trade->setCounterparty($this);
  133. }
  134. return $this;
  135. }
  136. public function removeTrade( $trade): self
  137. {
  138. if ($this->trades->removeElement($trade)) {
  139. // set the owning side to null (unless already changed)
  140. if ($trade->getCounterparty() === $this) {
  141. $trade->setCounterparty(null);
  142. }
  143. }
  144. return $this;
  145. }
  146. public function __toString() {
  147. return $this->getName();
  148. }
  149. /**
  150. * @return mixed
  151. */
  152. public function getOtm1() {
  153. return $this->otm1;
  154. }
  155. /**
  156. * @param mixed $otm1
  157. */
  158. public function setOtm1($otm1): void {
  159. $this->otm1 = $otm1;
  160. }
  161. /**
  162. * @return mixed
  163. */
  164. public function getOtm2() {
  165. return $this->otm2;
  166. }
  167. /**
  168. * @param mixed $otm2
  169. */
  170. public function setOtm2($otm2): void {
  171. $this->otm2 = $otm2;
  172. }
  173. /**
  174. * @return mixed
  175. */
  176. public function getOtm3() {
  177. return $this->otm3;
  178. }
  179. /**
  180. * @param mixed $otm3
  181. */
  182. public function setOtm3($otm3): void {
  183. $this->otm3 = $otm3;
  184. }
  185. /**
  186. * @return mixed
  187. */
  188. public function getVariationMargin1() {
  189. return $this->variationMargin1;
  190. }
  191. /**
  192. * @param mixed $variationMargin1
  193. */
  194. public function setVariationMargin1($variationMargin1): void {
  195. $this->variationMargin1 = $variationMargin1;
  196. }
  197. /**
  198. * @return mixed
  199. */
  200. public function getVariationMargin2() {
  201. return $this->variationMargin2;
  202. }
  203. /**
  204. * @param mixed $variationMargin2
  205. */
  206. public function setVariationMargin2($variationMargin2): void {
  207. $this->variationMargin2 = $variationMargin2;
  208. }
  209. /**
  210. * @return mixed
  211. */
  212. public function getVariationMargin3() {
  213. return $this->variationMargin3;
  214. }
  215. /**
  216. * @param mixed $variationMargin3
  217. */
  218. public function setVariationMargin3($variationMargin3): void {
  219. $this->variationMargin3 = $variationMargin3;
  220. }
  221. }