src/Bundles/Portfolios/Entity/Portfolio.php line 14

Open in your IDE?
  1. <?php
  2. namespace Bundles\Portfolios\Entity;
  3. use App\Entity\Customer;
  4. use App\Entity\CurrencyPair;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Bundles\Portfolios\Repository\PortfolioRepository;
  7. /**
  8. * @ORM\Entity(repositoryClass=PortfolioRepository::class)
  9. */
  10. class Portfolio {
  11. /**
  12. * @ORM\Id
  13. * @ORM\GeneratedValue
  14. * @ORM\Column(type="integer")
  15. */
  16. private $id;
  17. /**
  18. * @ORM\Column(type="string", length=255)
  19. */
  20. private $name;
  21. /**
  22. * @ORM\Column(type="text", nullable=true)
  23. */
  24. private $description;
  25. /**
  26. * @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="portfolios")
  27. * @ORM\JoinColumn(nullable=false)
  28. */
  29. private $customer;
  30. /**
  31. * @ORM\ManyToOne(targetEntity=CurrencyPair::class)
  32. * @ORM\JoinColumn(nullable=false, nullable=true)
  33. */
  34. private $CurrencyPair;
  35. /**
  36. * @ORM\Column(type="string", length=10, nullable=true)
  37. */
  38. private $direction;
  39. /**
  40. * @ORM\Column(type="boolean", nullable=true)
  41. */
  42. private $status;
  43. /**
  44. * @ORM\Column(type="string", length=20)
  45. */
  46. private $type;
  47. /**
  48. * @ORM\Column(type="json", nullable=true)
  49. */
  50. private $settings;
  51. public function __construct() {
  52. $this->created = date('Y-m-d');
  53. }
  54. public function getId(): ?int {
  55. return $this->id;
  56. }
  57. public function setId(int $id): self {
  58. $this->id = $id;
  59. return $this;
  60. }
  61. public function getName(): ?string {
  62. return $this->name;
  63. }
  64. public function setName(string $name): self {
  65. $this->name = $name;
  66. return $this;
  67. }
  68. public function getDescription(): ?string {
  69. return $this->description;
  70. }
  71. public function setDescription(?string $description): self {
  72. $this->description = $description;
  73. return $this;
  74. }
  75. public function getCustomer(): ?Customer {
  76. return $this->customer;
  77. }
  78. public function setCustomer(?Customer $customer): self {
  79. $this->customer = $customer;
  80. return $this;
  81. }
  82. public function getCurrency(): ?string {
  83. return $this->currency;
  84. }
  85. public function setCurrency(string $currency): self {
  86. $this->currency = $currency;
  87. return $this;
  88. }
  89. public function getCreated() {
  90. return $this->created;
  91. }
  92. public function getCurrencyPair(): ?CurrencyPair {
  93. return $this->CurrencyPair;
  94. }
  95. public function setCurrencyPair(?CurrencyPair $CurrencyPair): self {
  96. $this->CurrencyPair = $CurrencyPair;
  97. return $this;
  98. }
  99. public function getDirection(): ?string {
  100. return $this->direction;
  101. }
  102. public function setDirection(string $direction): self {
  103. $this->direction = $direction;
  104. return $this;
  105. }
  106. /**
  107. * @return mixed
  108. */
  109. public function getStatus() {
  110. return $this->status;
  111. }
  112. /**
  113. * @param mixed $status
  114. */
  115. public function setStatus($status): void {
  116. $this->status = $status;
  117. }
  118. /**
  119. * @return mixed
  120. */
  121. public function getType() {
  122. return $this->type;
  123. }
  124. /**
  125. * @param mixed $type
  126. */
  127. public function setType($type): void {
  128. $this->type = $type;
  129. }
  130. public function getListName(){
  131. $listName = $this->id.'. '.$this->name;
  132. if (empty($this->id)) {
  133. $listName = 'All';
  134. }
  135. return $listName;
  136. }
  137. /**
  138. * @return mixed
  139. */ public function getSettings() {
  140. return $this->settings;
  141. }
  142. /**
  143. * @param mixed $settings
  144. */ public function setSettings($settings): void {
  145. $this->settings = $settings;
  146. }
  147. public function __toString() {
  148. return $this->getName();
  149. }
  150. }