<?php
namespace Bundles\Portfolios\Entity;
use App\Entity\Customer;
use App\Entity\CurrencyPair;
use Doctrine\ORM\Mapping as ORM;
use Bundles\Portfolios\Repository\PortfolioRepository;
/**
* @ORM\Entity(repositoryClass=PortfolioRepository::class)
*/
class Portfolio {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="portfolios")
* @ORM\JoinColumn(nullable=false)
*/
private $customer;
/**
* @ORM\ManyToOne(targetEntity=CurrencyPair::class)
* @ORM\JoinColumn(nullable=false)
*/
private $CurrencyPair;
/**
* @ORM\Column(type="string", length=10)
*/
private $direction;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $status;
/**
* @ORM\Column(type="string", length=20)
*/
private $type;
public function __construct() {
$this->created = date('Y-m-d');
}
public function getId(): ?int {
return $this->id;
}
public function setId(int $id): self {
$this->id = $id;
return $this;
}
public function getName(): ?string {
return $this->name;
}
public function setName(string $name): self {
$this->name = $name;
return $this;
}
public function getDescription(): ?string {
return $this->description;
}
public function setDescription(?string $description): self {
$this->description = $description;
return $this;
}
public function getCustomer(): ?Customer {
return $this->customer;
}
public function setCustomer(?Customer $customer): self {
$this->customer = $customer;
return $this;
}
public function getCurrency(): ?string {
return $this->currency;
}
public function setCurrency(string $currency): self {
$this->currency = $currency;
return $this;
}
public function getCreated() {
return $this->created;
}
public function getCurrencyPair(): ?CurrencyPair {
return $this->CurrencyPair;
}
public function setCurrencyPair(?CurrencyPair $CurrencyPair): self {
$this->CurrencyPair = $CurrencyPair;
return $this;
}
public function getDirection(): ?string {
return $this->direction;
}
public function setDirection(string $direction): self {
$this->direction = $direction;
return $this;
}
/**
* @return mixed
*/
public function getStatus() {
return $this->status;
}
/**
* @param mixed $status
*/
public function setStatus($status): void {
$this->status = $status;
}
/**
* @return mixed
*/
public function getType() {
return $this->type;
}
/**
* @param mixed $type
*/
public function setType($type): void {
$this->type = $type;
}
public function getListName(){
$listName = $this->id.'. '.$this->name;
if (empty($this->id)) {
$listName = 'All';
}
return $listName;
}
public function __toString() {
return $this->getName();
}
}