src/IlaveU/ShopBundle/Entity/Customer/CustomerWalletPoint.php line 15

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