<?php
namespace App\Entity;
use Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface;
use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableTrait;
use Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait;
use Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface;
use Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait;
use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @Doctrine\ORM\Mapping\Entity
* @Doctrine\ORM\Mapping\Table(name="availability")
* @Doctrine\ORM\Mapping\Entity()
*/
class Availability implements TranslatableInterface, BlameableInterface, TimestampableInterface, SoftDeletableInterface {
use BlameableTrait;
use TimestampableTrait;
use TranslatableTrait;
use SoftDeletableTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Product", mappedBy="availability", cascade={"all"})
*/
protected $products;
/**
* @Doctrine\ORM\Mapping\Column(name="is_visible", type="boolean", options={"default"=0}, nullable=true)
*/
protected $isVisible;
/**
* @Doctrine\ORM\Mapping\Column(name="is_currentyly_unavailable", type="boolean", options={"default"=0}, nullable=true)
*/
protected $isCurrentlyUnavailable;
/**
* @var integer
*
* @ORM\Column(name="days", type="integer", length=6, nullable=true)
*/
private $days;
/**
* @var integer
*
* @ORM\Column(name="ceneo_days", type="integer", length=6, nullable=true)
*/
private $ceneoDays;
/**
* @var string
*
* @ORM\Column(name="internal_name", type="string", length=255, nullable=true)
*/
private $internalName;
/**
* @return mixed
*/
public function getIsVisible()
{
return $this->isVisible;
}
/**
* @param mixed $isVisible
*/
public function setIsVisible($isVisible): void
{
$this->isVisible = $isVisible;
}
public function __construct()
{
$this->products = new ArrayCollection();
}
/**
* Obsługa tłumaczeń
* @param $method
* @param $arguments
* @return mixed
*/
public function __call($method, $arguments)
{
return $this->proxyCurrentLocaleTranslation($method, $arguments);
}
public function getName(){
return $this->translate()->getName();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection|Product[]
*/
public function getProducts(): Collection
{
return $this->products;
}
public function addProduct(Product $product): self
{
if (!$this->products->contains($product)) {
$this->products[] = $product;
$product->setAvailability($this);
}
return $this;
}
public function removeProduct(Product $product): self
{
if ($this->products->contains($product)) {
$this->products->removeElement($product);
// set the owning side to null (unless already changed)
if ($product->getAvailability() === $this) {
$product->setAvailability(null);
}
}
return $this;
}
/**
* @return int
*/
public function getDays()
{
return $this->days;
}
/**
* @param int $days
*/
public function setDays($days)
{
$this->days = $days;
}
/**
* @return string
*/
public function getInternalName()
{
return $this->internalName;
}
/**
* @param string $internalName
*/
public function setInternalName($internalName)
{
$this->internalName = $internalName;
}
/**
* @return mixed
*/
public function getIsCurrentlyUnavailable()
{
return $this->isCurrentlyUnavailable;
}
/**
* @param mixed $isCurrentlyUnavailable
*/
public function setIsCurrentlyUnavailable($isCurrentlyUnavailable)
{
$this->isCurrentlyUnavailable = $isCurrentlyUnavailable;
}
/**
* @return int
*/
public function getCeneoDays(): ?int
{
return $this->ceneoDays;
}
/**
* @param int $ceneoDays
*/
public function setCeneoDays(?int $ceneoDays): void
{
$this->ceneoDays = $ceneoDays;
}
}