src/Entity/CreditPack.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Wits\PaymentBundle\Entity\LineItemInterface;
  5. /**
  6.  *
  7.  * @ORM\Table(name="credit_pack")
  8.  * @ORM\Entity(repositoryClass="App\Repository\CreditPackRepository")
  9.  *
  10.  * @ORM\InheritanceType("SINGLE_TABLE")
  11.  * @ORM\DiscriminatorMap(
  12.  *    {
  13.  *      "generic" = "App\Entity\CreditPackGeneric",
  14.  *      "custom" = "App\Entity\CreditPackCustom",
  15.  *      "sms" = "App\Entity\SmsCreditPackGeneric",
  16.  *     "sms_custom" = "App\Entity\SmsCreditPackCustom"
  17.  * })
  18.  */
  19. abstract class CreditPack implements LineItemInterface
  20. {
  21.     /**
  22.      * @ORM\Id()
  23.      * @ORM\GeneratedValue()
  24.      * @ORM\Column(type="integer")
  25.      */
  26.     protected $id;
  27.     /**
  28.      * @ORM\Column(type="decimal", precision=10, scale=2)
  29.      */
  30.     protected $price;
  31.     /**
  32.      * @ORM\Column(type="integer")
  33.      */
  34.     protected $nbProspects;
  35.     /**
  36.      * @ORM\Column(type="string", length=255)
  37.      */
  38.     protected $name;
  39.     /**
  40.      * @ORM\Column(type="string", length=255)
  41.      */
  42.     protected $description;
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getPrice(): float
  48.     {
  49.         return $this->price;
  50.     }
  51.     public function setPrice(float $price): self
  52.     {
  53.         $this->price $price;
  54.         return $this;
  55.     }
  56.     public function getNbProspects(): ?int
  57.     {
  58.         return $this->nbProspects;
  59.     }
  60.     public function setNbProspects(int $nbProspects): self
  61.     {
  62.         $this->nbProspects $nbProspects;
  63.         return $this;
  64.     }
  65.     public function getImages(): array
  66.     {
  67.         return [];
  68.     }
  69.     public function getAmount(): float
  70.     {
  71.         return $this->getPrice();
  72.     }
  73.     public function getQuantity(): int
  74.     {
  75.         return 1;
  76.     }
  77.     public function getFullPrice(): float{
  78.         return round($this->price .2 $this->price2);
  79.     }
  80.     public function getName(): string
  81.     {
  82.         return $this->name;
  83.     }
  84.     public function setName(string $name): self
  85.     {
  86.         $this->name $name;
  87.         return $this;
  88.     }
  89.     public function getDescription(): string
  90.     {
  91.         return $this->description;
  92.     }
  93.     public function setDescription(string $description): self
  94.     {
  95.         $this->description $description;
  96.         return $this;
  97.     }
  98.     public function isCreditPack(){
  99.         return true;
  100.     }
  101.     public function isSmsCreditPack(){
  102.         return false;
  103.     }
  104. }