src/Entity/Payout.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PayoutRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=PayoutRepository::class)
  9.  */
  10. class Payout
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="float", nullable=true)
  20.      */
  21.     private $amt;
  22.     /**
  23.      * @ORM\Column(type="boolean", nullable=true)
  24.      */
  25.     private $isPayed;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="payouts")
  28.      */
  29.     private $seller;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=PromoCode::class)
  32.      */
  33.     private $promoCode;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity=PromoCodeUsage::class, mappedBy="payout")
  36.      */
  37.     private $promoCodeUsages;
  38.     /**
  39.      * @ORM\Column(type="datetime_immutable", nullable=true)
  40.      */
  41.     private $createdAt;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=PaymentMethod::class)
  44.      */
  45.     private $paymentMethod;
  46.     /**
  47.      * @ORM\Column(type="string", length=1000, nullable=true)
  48.      */
  49.     private $comentarios;
  50.     /**
  51.      * @ORM\Column(type="string", length=255, nullable=true)
  52.      */
  53.     private $currentPlace;
  54.     public function __construct()
  55.     {
  56.         $this->promoCodeUsages = new ArrayCollection();
  57.         if(!$this->createdAt$this->setCreatedAt(new \DateTimeImmutable());
  58.         if(!$this->currentPlace$this->setCurrentPlace('unpaid');
  59.     }
  60.     public function getId(): ?int
  61.     {
  62.         return $this->id;
  63.     }
  64.     public function getAmt(): ?float
  65.     {
  66.         return $this->amt;
  67.     }
  68.     public function setAmt(?float $amt): self
  69.     {
  70.         $this->amt $amt;
  71.         return $this;
  72.     }
  73.     public function isIsPayed(): ?bool
  74.     {
  75.         return $this->isPayed;
  76.     }
  77.     public function setIsPayed(?bool $isPayed): self
  78.     {
  79.         $this->isPayed $isPayed;
  80.         return $this;
  81.     }
  82.     public function getSeller(): ?User
  83.     {
  84.         return $this->seller;
  85.     }
  86.     public function setSeller(?User $seller): self
  87.     {
  88.         $this->seller $seller;
  89.         return $this;
  90.     }
  91.     public function getPromoCode(): ?PromoCode
  92.     {
  93.         return $this->promoCode;
  94.     }
  95.     public function setPromoCode(?PromoCode $promoCode): self
  96.     {
  97.         $this->promoCode $promoCode;
  98.         return $this;
  99.     }
  100.     public function getPromoCodeUser()
  101.     {
  102.         return $this->getPromoCode()->getUser();
  103.     }
  104.     /**
  105.      * @return Collection<int, PromoCodeUsage>
  106.      */
  107.     public function getPromoCodeUsages(): Collection
  108.     {
  109.         return $this->promoCodeUsages;
  110.     }
  111.     public function addPromoCodeUsage(PromoCodeUsage $promoCodeUsage): self
  112.     {
  113.         if (!$this->promoCodeUsages->contains($promoCodeUsage)) {
  114.             $this->promoCodeUsages[] = $promoCodeUsage;
  115.             $promoCodeUsage->setPayout($this);
  116.         }
  117.         return $this;
  118.     }
  119.     public function removePromoCodeUsage(PromoCodeUsage $promoCodeUsage): self
  120.     {
  121.         if ($this->promoCodeUsages->removeElement($promoCodeUsage)) {
  122.             // set the owning side to null (unless already changed)
  123.             if ($promoCodeUsage->getPayout() === $this) {
  124.                 $promoCodeUsage->setPayout(null);
  125.             }
  126.         }
  127.         return $this;
  128.     }
  129.     public function __toString()
  130.     {
  131.         return $this->getPromoCode()->getContent();
  132.     }
  133.     public function getCreatedAt(): ?\DateTimeImmutable
  134.     {
  135.         return $this->createdAt;
  136.     }
  137.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  138.     {
  139.         $this->createdAt $createdAt;
  140.         return $this;
  141.     }
  142.     public function getPaymentMethod(): ?PaymentMethod
  143.     {
  144.         return $this->paymentMethod;
  145.     }
  146.     public function setPaymentMethod(?PaymentMethod $paymentMethod): self
  147.     {
  148.         $this->paymentMethod $paymentMethod;
  149.         return $this;
  150.     }
  151.     public function getComentarios(): ?string
  152.     {
  153.         return $this->comentarios;
  154.     }
  155.     public function setComentarios(?string $comentarios): self
  156.     {
  157.         $this->comentarios $comentarios;
  158.         return $this;
  159.     }
  160.     public function getCurrentPlace(): ?string
  161.     {
  162.         return $this->currentPlace;
  163.     }
  164.     public function setCurrentPlace(?string $currentPlace): self
  165.     {
  166.         $this->currentPlace $currentPlace;
  167.         return $this;
  168.     }
  169. }