src/Flexy/ShopBundle/Entity/Customer/CustomerWalletPoint.php line 13
<?php
namespace App\Flexy\ShopBundle\Entity\Customer;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Flexy\ShopBundle\Entity\Accounting\Invoice;
use App\Flexy\ShopBundle\Entity\Order\Order;
use App\Flexy\ShopBundle\Repository\Customer\CustomerWalletPointRepository;
use Doctrine\ORM\Mapping as ORM;
#[ApiResource]
#[ORM\Entity(repositoryClass: CustomerWalletPointRepository::class)]
class CustomerWalletPoint implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'float')]
private ?float $points = null;
#[ORM\ManyToOne(targetEntity: Customer::class, inversedBy: 'customerWalletPoints')]
private ?\App\Flexy\ShopBundle\Entity\Customer\Customer $customer = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $note = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $source = null;
#[ORM\Column(type: 'datetime', nullable: true)]
private \DateTime|\DateTimeInterface|null $createdAt = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $type = null;
#[ORM\ManyToOne(targetEntity: Order::class, inversedBy: 'customerWalletPoints')]
private ?\App\Flexy\ShopBundle\Entity\Order\Order $originOrder = null;
#[ORM\ManyToOne(inversedBy: 'customerWalletPoints')]
private ?Invoice $originInvoice = null;
public function __toString(): string
{
$originOrder = "";
if($this->originOrder){
" liƩ a la commande ".$this->originOrder->getOrderNumber();
}
return $this->points. " pts ".$originOrder;
}
public function __construct()
{
$this->createdAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getPoints(): ?float
{
return $this->points;
}
public function setPoints(float $points): self
{
$this->points = $points;
return $this;
}
public function getCustomer(): ?Customer
{
return $this->customer;
}
public function setCustomer(?Customer $customer): self
{
$this->customer = $customer;
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
public function getSource(): ?string
{
return $this->source;
}
public function setSource(?string $source): self
{
$this->source = $source;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getOriginOrder(): ?Order
{
return $this->originOrder;
}
public function setOriginOrder(?Order $originOrder): self
{
$this->originOrder = $originOrder;
return $this;
}
public function getOriginInvoice(): ?Invoice
{
return $this->originInvoice;
}
public function setOriginInvoice(?Invoice $originInvoice): self
{
$this->originInvoice = $originInvoice;
return $this;
}
}