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. /**
  52. * @ORM\Column(type="string", length=20, nullable=true)
  53. */
  54. private $lastValuation;
  55. public function __construct() {
  56. $this->created = date('Y-m-d');
  57. }
  58. public function getId(): ?int {
  59. return $this->id;
  60. }
  61. public function setId(int $id): self {
  62. $this->id = $id;
  63. return $this;
  64. }
  65. public function getName(): ?string {
  66. return $this->name;
  67. }
  68. public function setName(string $name): self {
  69. $this->name = $name;
  70. return $this;
  71. }
  72. public function getDescription(): ?string {
  73. return $this->description;
  74. }
  75. public function setDescription(?string $description): self {
  76. $this->description = $description;
  77. return $this;
  78. }
  79. public function getCustomer(): ?Customer {
  80. return $this->customer;
  81. }
  82. public function setCustomer(?Customer $customer): self {
  83. $this->customer = $customer;
  84. return $this;
  85. }
  86. public function getCurrency(): ?string {
  87. return $this->currency;
  88. }
  89. public function setCurrency(string $currency): self {
  90. $this->currency = $currency;
  91. return $this;
  92. }
  93. public function getCreated() {
  94. return $this->created;
  95. }
  96. public function getCurrencyPair(): ?CurrencyPair {
  97. return $this->CurrencyPair;
  98. }
  99. public function setCurrencyPair(?CurrencyPair $CurrencyPair): self {
  100. $this->CurrencyPair = $CurrencyPair;
  101. return $this;
  102. }
  103. public function getDirection(): ?string {
  104. return $this->direction;
  105. }
  106. public function setDirection(string $direction): self {
  107. $this->direction = $direction;
  108. return $this;
  109. }
  110. /**
  111. * @return mixed
  112. */
  113. public function getStatus() {
  114. return $this->status;
  115. }
  116. /**
  117. * @param mixed $status
  118. */
  119. public function setStatus($status): void {
  120. $this->status = $status;
  121. }
  122. /**
  123. * @return mixed
  124. */
  125. public function getType() {
  126. return $this->type;
  127. }
  128. /**
  129. * @param mixed $type
  130. */
  131. public function setType($type): void {
  132. $this->type = $type;
  133. }
  134. public function getListName(){
  135. $listName = $this->id.'. '.$this->name;
  136. if (empty($this->id)) {
  137. $listName = 'All';
  138. }
  139. return $listName;
  140. }
  141. /**
  142. * @return mixed
  143. */ public function getSettings() {
  144. return $this->settings;
  145. }
  146. /**
  147. * @param mixed $settings
  148. */ public function setSettings($settings): void {
  149. $this->settings = $settings;
  150. }
  151. public function __toString() {
  152. return $this->getName();
  153. }
  154. public function getLastValuation(): ?string {
  155. return $this->lastValuation;
  156. }
  157. public function setLastValuation(?string $lastValuation): self {
  158. $this->lastValuation = $lastValuation;
  159. return $this;
  160. }
  161. }