src/Entity/Gos/VirtualCurrency/VirtualCurrency.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos\VirtualCurrency;
  3. use App\Entity\Gos\PortalSettings;
  4. use App\Entity\Gos\ProductVariant;
  5. use App\Repository\Gos\VirtualCurrency\VirtualCurrencyRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Entity(repositoryClass=VirtualCurrencyRepository::class)
  11.  * @ORM\HasLifecycleCallbacks()
  12.  */
  13. class VirtualCurrency
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255)
  23.      */
  24.     private $name;
  25.     /**
  26.      * @ORM\Column(type="datetime")
  27.      */
  28.     private $createdAt;
  29.     /**
  30.      * @ORM\Column(type="datetime", nullable=true)
  31.      */
  32.     private $updatedAt;
  33.     /**
  34.      * @ORM\OneToMany(targetEntity=VirtualCurrencyWallet::class, mappedBy="virtualCurrency")
  35.      */
  36.     private $virtualCurrencyWallets;
  37.     /**
  38.      * @ORM\OneToMany(targetEntity=VirtualCurrencyTransaction::class, mappedBy="virtualCurrency")
  39.      */
  40.     private $virtualCurrencyTransactions;
  41.     /**
  42.      * @ORM\OneToMany(targetEntity=VirtualCurrencyOrder::class, mappedBy="virtualCurrency")
  43.      */
  44.     private $virtualCurrencyOrders;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity=PortalSettings::class, mappedBy="virtualCurrency")
  47.      */
  48.     private $portalSettings;
  49.     public function __construct()
  50.     {
  51.         $this->virtualCurrencyWallets      = new ArrayCollection();
  52.         $this->virtualCurrencyTransactions = new ArrayCollection();
  53.         $this->virtualCurrencyOrders       = new ArrayCollection();
  54.         $this->portalSettings = new ArrayCollection();
  55.     }
  56.     public function __toString()
  57.     {
  58.         return $this->name;
  59.     }
  60.     /**
  61.      * @ORM\PrePersist()
  62.      */
  63.     public function prePersist()
  64.     {
  65.         $this->createdAt = new \DateTime();
  66.     }
  67.     /**
  68.      * @ORM\PreUpdate()
  69.      */
  70.     public function preUpdate()
  71.     {
  72.         $this->updatedAt = new \DateTime();
  73.     }
  74.     public function getObjectVars()
  75.     {
  76.         return get_object_vars($this);
  77.     }
  78.     public function getId(): ?int
  79.     {
  80.         return $this->id;
  81.     }
  82.     public function getName(): ?string
  83.     {
  84.         return $this->name;
  85.     }
  86.     public function setName(string $name): self
  87.     {
  88.         $this->name $name;
  89.         return $this;
  90.     }
  91.     public function getCreatedAt(): ?\DateTimeInterface
  92.     {
  93.         return $this->createdAt;
  94.     }
  95.     public function getUpdatedAt(): ?\DateTimeInterface
  96.     {
  97.         return $this->updatedAt;
  98.     }
  99.     /**
  100.      * @return Collection|VirtualCurrencyWallet[]
  101.      */
  102.     public function getVirtualCurrencyWallets(): Collection
  103.     {
  104.         return $this->virtualCurrencyWallets;
  105.     }
  106.     public function addVirtualCurrencyWallet(VirtualCurrencyWallet $virtualCurrencyWallet): self
  107.     {
  108.         if (!$this->virtualCurrencyWallets->contains($virtualCurrencyWallet)) {
  109.             $this->virtualCurrencyWallets[] = $virtualCurrencyWallet;
  110.             $virtualCurrencyWallet->setVirtualCurrency($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removeVirtualCurrencyWallet(VirtualCurrencyWallet $virtualCurrencyWallet): self
  115.     {
  116.         if ($this->virtualCurrencyWallets->contains($virtualCurrencyWallet)) {
  117.             $this->virtualCurrencyWallets->removeElement($virtualCurrencyWallet);
  118.             // set the owning side to null (unless already changed)
  119.             if ($virtualCurrencyWallet->getVirtualCurrency() === $this) {
  120.                 $virtualCurrencyWallet->setVirtualCurrency(null);
  121.             }
  122.         }
  123.         return $this;
  124.     }
  125.     /**
  126.      * @return Collection|VirtualCurrencyTransaction[]
  127.      */
  128.     public function getVirtualCurrencyTransactions(): Collection
  129.     {
  130.         return $this->virtualCurrencyTransactions;
  131.     }
  132.     public function addVirtualCurrencyTransaction(VirtualCurrencyTransaction $virtualCurrencyTransaction): self
  133.     {
  134.         if (!$this->virtualCurrencyTransactions->contains($virtualCurrencyTransaction)) {
  135.             $this->virtualCurrencyTransactions[] = $virtualCurrencyTransaction;
  136.             $virtualCurrencyTransaction->setVirtualCurrency($this);
  137.         }
  138.         return $this;
  139.     }
  140.     public function removeVirtualCurrencyTransaction(VirtualCurrencyTransaction $virtualCurrencyTransaction): self
  141.     {
  142.         if ($this->virtualCurrencyTransactions->contains($virtualCurrencyTransaction)) {
  143.             $this->virtualCurrencyTransactions->removeElement($virtualCurrencyTransaction);
  144.             // set the owning side to null (unless already changed)
  145.             if ($virtualCurrencyTransaction->getVirtualCurrency() === $this) {
  146.                 $virtualCurrencyTransaction->setVirtualCurrency(null);
  147.             }
  148.         }
  149.         return $this;
  150.     }
  151.     /**
  152.      * @return Collection|VirtualCurrencyOrder[]
  153.      */
  154.     public function getVirtualCurrencyOrders(): Collection
  155.     {
  156.         return $this->virtualCurrencyOrders;
  157.     }
  158.     public function addVirtualCurrencyOrder(VirtualCurrencyOrder $virtualCurrencyOrder): self
  159.     {
  160.         if (!$this->virtualCurrencyOrders->contains($virtualCurrencyOrder)) {
  161.             $this->virtualCurrencyOrders[] = $virtualCurrencyOrder;
  162.             $virtualCurrencyOrder->setVirtualCurrency($this);
  163.         }
  164.         return $this;
  165.     }
  166.     public function removeVirtualCurrencyOrder(VirtualCurrencyOrder $virtualCurrencyOrder): self
  167.     {
  168.         if ($this->virtualCurrencyOrders->contains($virtualCurrencyOrder)) {
  169.             $this->virtualCurrencyOrders->removeElement($virtualCurrencyOrder);
  170.             // set the owning side to null (unless already changed)
  171.             if ($virtualCurrencyOrder->getVirtualCurrency() === $this) {
  172.                 $virtualCurrencyOrder->setVirtualCurrency(null);
  173.             }
  174.         }
  175.         return $this;
  176.     }
  177.     /**
  178.      * @return Collection|PortalSettings[]
  179.      */
  180.     public function getPortalSettings(): Collection
  181.     {
  182.         return $this->portalSettings;
  183.     }
  184.     public function addPortalSetting(PortalSettings $portalSetting): self
  185.     {
  186.         if (!$this->portalSettings->contains($portalSetting)) {
  187.             $this->portalSettings[] = $portalSetting;
  188.             $portalSetting->setVirtualCurrency($this);
  189.         }
  190.         return $this;
  191.     }
  192.     public function removePortalSetting(PortalSettings $portalSetting): self
  193.     {
  194.         if ($this->portalSettings->contains($portalSetting)) {
  195.             $this->portalSettings->removeElement($portalSetting);
  196.             // set the owning side to null (unless already changed)
  197.             if ($portalSetting->getVirtualCurrency() === $this) {
  198.                 $portalSetting->setVirtualCurrency(null);
  199.             }
  200.         }
  201.         return $this;
  202.     }
  203. }