src/Flexy/ShopBundle/Entity/Customer/CustomerWalletPoint.php line 13

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Customer;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Flexy\ShopBundle\Entity\Accounting\Invoice;
  5. use App\Flexy\ShopBundle\Entity\Order\Order;
  6. use App\Flexy\ShopBundle\Repository\Customer\CustomerWalletPointRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ApiResource]
  9. #[ORM\Entity(repositoryClassCustomerWalletPointRepository::class)]
  10. class CustomerWalletPoint implements \Stringable
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private $id;
  16.     #[ORM\Column(type'float')]
  17.     private ?float $points null;
  18.     #[ORM\ManyToOne(targetEntityCustomer::class, inversedBy'customerWalletPoints')]
  19.     private ?\App\Flexy\ShopBundle\Entity\Customer\Customer $customer null;
  20.     #[ORM\Column(type'text'nullabletrue)]
  21.     private ?string $note null;
  22.     #[ORM\Column(type'string'length255nullabletrue)]
  23.     private ?string $source null;
  24.     #[ORM\Column(type'datetime'nullabletrue)]
  25.     private \DateTime|\DateTimeInterface|null $createdAt null;
  26.     #[ORM\Column(type'string'length255nullabletrue)]
  27.     private ?string $type null;
  28.     #[ORM\ManyToOne(targetEntityOrder::class, inversedBy'customerWalletPoints')]
  29.     private ?\App\Flexy\ShopBundle\Entity\Order\Order $originOrder null;
  30.     #[ORM\ManyToOne(inversedBy'customerWalletPoints')]
  31.     private ?Invoice $originInvoice null;
  32.     public function __toString(): string
  33.     {
  34.         $originOrder "";
  35.         if($this->originOrder){
  36.             " liĆ© a la commande ".$this->originOrder->getOrderNumber();
  37.         }
  38.         return $this->points" EUR ".$originOrder;
  39.     }
  40.     public function __construct()
  41.     {
  42.         $this->createdAt = new \DateTime();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getPoints(): ?float
  49.     {
  50.         return $this->points;
  51.     }
  52.     public function setPoints(float $points): self
  53.     {
  54.         $this->points $points;
  55.         return $this;
  56.     }
  57.     public function getCustomer(): ?Customer
  58.     {
  59.         return $this->customer;
  60.     }
  61.     public function setCustomer(?Customer $customer): self
  62.     {
  63.         $this->customer $customer;
  64.         return $this;
  65.     }
  66.     public function getNote(): ?string
  67.     {
  68.         return $this->note;
  69.     }
  70.     public function setNote(?string $note): self
  71.     {
  72.         $this->note $note;
  73.         return $this;
  74.     }
  75.     public function getSource(): ?string
  76.     {
  77.         return $this->source;
  78.     }
  79.     public function setSource(?string $source): self
  80.     {
  81.         $this->source $source;
  82.         return $this;
  83.     }
  84.     public function getCreatedAt(): ?\DateTimeInterface
  85.     {
  86.         return $this->createdAt;
  87.     }
  88.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  89.     {
  90.         $this->createdAt $createdAt;
  91.         return $this;
  92.     }
  93.     public function getType(): ?string
  94.     {
  95.         return $this->type;
  96.     }
  97.     public function setType(?string $type): self
  98.     {
  99.         $this->type $type;
  100.         return $this;
  101.     }
  102.     public function getOriginOrder(): ?Order
  103.     {
  104.         return $this->originOrder;
  105.     }
  106.     public function setOriginOrder(?Order $originOrder): self
  107.     {
  108.         $this->originOrder $originOrder;
  109.         return $this;
  110.     }
  111.     public function getOriginInvoice(): ?Invoice
  112.     {
  113.         return $this->originInvoice;
  114.     }
  115.     public function setOriginInvoice(?Invoice $originInvoice): self
  116.     {
  117.         $this->originInvoice $originInvoice;
  118.         return $this;
  119.     }
  120. }