src/Entity/Availability.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface;
  4. use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableTrait;
  5. use Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait;
  6. use Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface;
  7. use Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait;
  8. use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface;
  9. use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
  10. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\ORM\Mapping as ORM;
  14. /**
  15.  * @Doctrine\ORM\Mapping\Entity
  16.  * @Doctrine\ORM\Mapping\Table(name="availability")
  17.  * @Doctrine\ORM\Mapping\Entity()
  18.  */
  19. class Availability implements TranslatableInterfaceBlameableInterfaceTimestampableInterfaceSoftDeletableInterface  {
  20.     use BlameableTrait;
  21.     use TimestampableTrait;
  22.     use TranslatableTrait;
  23.     use SoftDeletableTrait;
  24.     
  25.     
  26.     
  27.     /**
  28.      * @var integer
  29.      *
  30.      * @ORM\Column(name="id", type="integer", nullable=false)
  31.      * @ORM\Id
  32.      * @ORM\GeneratedValue(strategy="IDENTITY")
  33.      */
  34.     private $id;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity="App\Entity\Product", mappedBy="availability", cascade={"all"})
  37.      */
  38.     protected $products;
  39.     /**
  40.      * @Doctrine\ORM\Mapping\Column(name="is_visible", type="boolean", options={"default"=0}, nullable=true)
  41.      */
  42.     protected $isVisible;
  43.     /**
  44.      * @Doctrine\ORM\Mapping\Column(name="is_currentyly_unavailable", type="boolean", options={"default"=0}, nullable=true)
  45.      */
  46.     protected $isCurrentlyUnavailable;
  47.     /**
  48.      * @var integer
  49.      *
  50.      * @ORM\Column(name="days", type="integer", length=6, nullable=true)
  51.      */
  52.     private $days;
  53.     /**
  54.      * @var integer
  55.      *
  56.      * @ORM\Column(name="ceneo_days", type="integer", length=6, nullable=true)
  57.      */
  58.     private $ceneoDays;
  59.     /**
  60.      * @var string
  61.      *
  62.      * @ORM\Column(name="internal_name", type="string", length=255, nullable=true)
  63.      */
  64.     private $internalName;
  65.     /**
  66.      * @return mixed
  67.      */
  68.     public function getIsVisible()
  69.     {
  70.         return $this->isVisible;
  71.     }
  72.     /**
  73.      * @param mixed $isVisible
  74.      */
  75.     public function setIsVisible($isVisible): void
  76.     {
  77.         $this->isVisible $isVisible;
  78.     }
  79.     public function __construct()
  80.     {
  81.         $this->products = new ArrayCollection();
  82.     }
  83.     
  84.     /**
  85.      * Obsługa tłumaczeń
  86.      * @param $method
  87.      * @param $arguments
  88.      * @return mixed
  89.      */
  90.     public function __call($method$arguments)
  91.     {
  92.         return $this->proxyCurrentLocaleTranslation($method$arguments);
  93.     }
  94.     public function getName(){
  95.         return $this->translate()->getName();
  96.     }
  97.     public function getId(): ?int
  98.     {
  99.         return $this->id;
  100.     }
  101.     /**
  102.      * @return Collection|Product[]
  103.      */
  104.     public function getProducts(): Collection
  105.     {
  106.         return $this->products;
  107.     }
  108.     public function addProduct(Product $product): self
  109.     {
  110.         if (!$this->products->contains($product)) {
  111.             $this->products[] = $product;
  112.             $product->setAvailability($this);
  113.         }
  114.         return $this;
  115.     }
  116.     public function removeProduct(Product $product): self
  117.     {
  118.         if ($this->products->contains($product)) {
  119.             $this->products->removeElement($product);
  120.             // set the owning side to null (unless already changed)
  121.             if ($product->getAvailability() === $this) {
  122.                 $product->setAvailability(null);
  123.             }
  124.         }
  125.         return $this;
  126.     }
  127.     /**
  128.      * @return int
  129.      */
  130.     public function getDays()
  131.     {
  132.         return $this->days;
  133.     }
  134.     /**
  135.      * @param int $days
  136.      */
  137.     public function setDays($days)
  138.     {
  139.         $this->days $days;
  140.     }
  141.     /**
  142.      * @return string
  143.      */
  144.     public function getInternalName()
  145.     {
  146.         return $this->internalName;
  147.     }
  148.     /**
  149.      * @param string $internalName
  150.      */
  151.     public function setInternalName($internalName)
  152.     {
  153.         $this->internalName $internalName;
  154.     }
  155.     /**
  156.      * @return mixed
  157.      */
  158.     public function getIsCurrentlyUnavailable()
  159.     {
  160.         return $this->isCurrentlyUnavailable;
  161.     }
  162.     /**
  163.      * @param mixed $isCurrentlyUnavailable
  164.      */
  165.     public function setIsCurrentlyUnavailable($isCurrentlyUnavailable)
  166.     {
  167.         $this->isCurrentlyUnavailable $isCurrentlyUnavailable;
  168.     }
  169.     /**
  170.      * @return int
  171.      */
  172.     public function getCeneoDays(): ?int
  173.     {
  174.         return $this->ceneoDays;
  175.     }
  176.     /**
  177.      * @param int $ceneoDays
  178.      */
  179.     public function setCeneoDays(?int $ceneoDays): void
  180.     {
  181.         $this->ceneoDays $ceneoDays;
  182.     }
  183. }