src/Entity/Slave/ProductCondition.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Slave;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="eposm_s_product_condition")
  9.  * @ORM\Entity
  10.  */
  11. class ProductCondition
  12. {      
  13.     public function isStatusAvailable(){
  14.         if($this->getSlug() == 'new' || $this->getSlug() == 'refurbished' || $this->getSlug() == 'repaired' || $this->getSlug() == 'free' || $this->getSlug() == 'regenerated')
  15.             return true;
  16.         return false;
  17.     }
  18.     /**
  19.      * @ORM\Column(name="id", type="bigint")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     protected $id;
  24.     
  25.     /**
  26.      * @ORM\Column(name="slug", type="string", unique=true, length=191)
  27.      */
  28.     protected $slug;
  29.     
  30.     /**
  31.      * @ORM\Column(name="value", type="string", length=191)
  32.      */
  33.     protected $value;
  34.     // OneToMany
  35.         /**
  36.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\Product", mappedBy="condition")
  37.          */
  38.         private $products;
  39.         public function __construct()
  40.         {
  41.             $this->products = new ArrayCollection();
  42.         }
  43.     //
  44.     public function getId(): ?string
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getSlug(): ?string
  49.     {
  50.         return $this->slug;
  51.     }
  52.     public function setSlug(string $slug): self
  53.     {
  54.         $this->slug $slug;
  55.         return $this;
  56.     }
  57.     public function getValue(): ?string
  58.     {
  59.         return $this->value;
  60.     }
  61.     public function setValue(string $value): self
  62.     {
  63.         $this->value $value;
  64.         return $this;
  65.     }
  66.     /**
  67.      * @return Collection<int, Product>
  68.      */
  69.     public function getProducts(): Collection
  70.     {
  71.         return $this->products;
  72.     }
  73.     public function addProduct(Product $product): self
  74.     {
  75.         if (!$this->products->contains($product)) {
  76.             $this->products->add($product);
  77.             $product->setCondition($this);
  78.         }
  79.         return $this;
  80.     }
  81.     public function removeProduct(Product $product): self
  82.     {
  83.         if ($this->products->removeElement($product)) {
  84.             // set the owning side to null (unless already changed)
  85.             if ($product->getCondition() === $this) {
  86.                 $product->setCondition(null);
  87.             }
  88.         }
  89.         return $this;
  90.     }
  91. }