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)
  33. */
  34. private $CurrencyPair;
  35. /**
  36. * @ORM\Column(type="string", length=10)
  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. public function __construct() {
  48. $this->created = date('Y-m-d');
  49. }
  50. public function getId(): ?int {
  51. return $this->id;
  52. }
  53. public function setId(int $id): self {
  54. $this->id = $id;
  55. return $this;
  56. }
  57. public function getName(): ?string {
  58. return $this->name;
  59. }
  60. public function setName(string $name): self {
  61. $this->name = $name;
  62. return $this;
  63. }
  64. public function getDescription(): ?string {
  65. return $this->description;
  66. }
  67. public function setDescription(?string $description): self {
  68. $this->description = $description;
  69. return $this;
  70. }
  71. public function getCustomer(): ?Customer {
  72. return $this->customer;
  73. }
  74. public function setCustomer(?Customer $customer): self {
  75. $this->customer = $customer;
  76. return $this;
  77. }
  78. public function getCurrency(): ?string {
  79. return $this->currency;
  80. }
  81. public function setCurrency(string $currency): self {
  82. $this->currency = $currency;
  83. return $this;
  84. }
  85. public function getCreated() {
  86. return $this->created;
  87. }
  88. public function getCurrencyPair(): ?CurrencyPair {
  89. return $this->CurrencyPair;
  90. }
  91. public function setCurrencyPair(?CurrencyPair $CurrencyPair): self {
  92. $this->CurrencyPair = $CurrencyPair;
  93. return $this;
  94. }
  95. public function getDirection(): ?string {
  96. return $this->direction;
  97. }
  98. public function setDirection(string $direction): self {
  99. $this->direction = $direction;
  100. return $this;
  101. }
  102. /**
  103. * @return mixed
  104. */
  105. public function getStatus() {
  106. return $this->status;
  107. }
  108. /**
  109. * @param mixed $status
  110. */
  111. public function setStatus($status): void {
  112. $this->status = $status;
  113. }
  114. /**
  115. * @return mixed
  116. */
  117. public function getType() {
  118. return $this->type;
  119. }
  120. /**
  121. * @param mixed $type
  122. */
  123. public function setType($type): void {
  124. $this->type = $type;
  125. }
  126. public function getListName(){
  127. $listName = $this->id.'. '.$this->name;
  128. if (empty($this->id)) {
  129. $listName = 'All';
  130. }
  131. return $listName;
  132. }
  133. public function __toString() {
  134. return $this->getName();
  135. }
  136. }