src/Entity/ProductEquipment.php line 27

Open in your IDE?
  1. <?php
  2. // src/Acme/UserBundle/Entity/User.php
  3. namespace App\Entity;
  4. use Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface;
  5. use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableTrait;
  6. use Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait;
  7. use Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface;
  8. use Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait;
  9. use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  13. /**
  14.  * @Doctrine\ORM\Mapping\Entity
  15.  * @Doctrine\ORM\Mapping\Table(name="product_equipment")
  16.  */
  17. class ProductEquipment implements BlameableInterfaceTimestampableInterfaceSoftDeletableInterface  {
  18.     use BlameableTrait;
  19.     use TimestampableTrait;
  20.     
  21.     use SoftDeletableTrait;
  22.     
  23. /**
  24.      * @var integer
  25.      *
  26.      * @ORM\Column(name="id", type="integer", nullable=false)
  27.      * @ORM\Id
  28.      * @ORM\GeneratedValue(strategy="IDENTITY")
  29.      */
  30.     private $id;
  31.     /**
  32.      * @var string
  33.      *
  34.      * @ORM\Column(name="name", type="string", length=255, nullable=true)
  35.      */
  36.     private $name;
  37.     /**
  38.      * @ORM\ManyToOne(targetEntity="App\Entity\Language")
  39.      * @ORM\JoinColumn(name="language_id", referencedColumnName="id")
  40.      */
  41.     protected $language;
  42.     /**
  43.      * @Doctrine\ORM\Mapping\Column(type="decimal", precision=10, scale=2, nullable=true, name="price_net")
  44.      */
  45.     protected $priceNet;
  46.     /**
  47.      * @Doctrine\ORM\Mapping\Column(type="decimal", precision=10, scale=2, nullable=true)
  48.      */
  49.     protected $price;
  50.     /**
  51.      * @Doctrine\ORM\Mapping\Column(type="boolean", nullable=true)
  52.      */
  53.     protected $visible true;
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getName(): ?string
  59.     {
  60.         return $this->name;
  61.     }
  62.     public function setName(?string $name): self
  63.     {
  64.         $this->name $name;
  65.         return $this;
  66.     }
  67.     public function getPrice()
  68.     {
  69.         $vat 23;
  70.         if ($this->getLanguage()->getId() == 1) { //pl
  71.             $vat 23;
  72.         }
  73.         if ($this->getLanguage()->getId() == 4) { //ro
  74.             $vat 19;
  75.         }
  76.         if ($this->getLanguage()->getId() == 3) { //sk
  77.             $vat 23;
  78.         }
  79.         if ($this->getLanguage()->getId() == 2) { //cz
  80.             $vat 21;
  81.         }
  82.         return round($this->getPriceNet() * ((100+$vat)/100), $this->getLanguage()->getRoundingPrecision());
  83.         return $this->price;
  84.     }
  85.     public function setPrice($price): self
  86.     {
  87.         $this->price $price;
  88.         return $this;
  89.     }
  90.     public function getLanguage(): ?Language
  91.     {
  92.         return $this->language;
  93.     }
  94.     public function setLanguage(?Language $language): self
  95.     {
  96.         $this->language $language;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return mixed
  101.      */
  102.     public function getPriceNet()
  103.     {
  104.         return $this->priceNet;
  105.     }
  106.     /**
  107.      * @param mixed $priceNet
  108.      */
  109.     public function setPriceNet($priceNet): void
  110.     {
  111.         $this->priceNet $priceNet;
  112.     }
  113.     /**
  114.      * @return bool
  115.      */
  116.     public function isVisible()
  117.     {
  118.         return $this->visible;
  119.     }
  120.     /**
  121.      * @param bool $visible
  122.      */
  123.     public function setVisible($visible): void
  124.     {
  125.         $this->visible $visible;
  126.     }
  127. }