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.         public function getId(): ?string
  44.         {
  45.             return $this->id;
  46.         }
  47.         public function getSlug(): ?string
  48.         {
  49.             return $this->slug;
  50.         }
  51.         public function setSlug(string $slug): static
  52.         {
  53.             $this->slug $slug;
  54.             return $this;
  55.         }
  56.         public function getValue(): ?string
  57.         {
  58.             return $this->value;
  59.         }
  60.         public function setValue(string $value): static
  61.         {
  62.             $this->value $value;
  63.             return $this;
  64.         }
  65.         /**
  66.          * @return Collection<int, Product>
  67.          */
  68.         public function getProducts(): Collection
  69.         {
  70.             return $this->products;
  71.         }
  72.         public function addProduct(Product $product): static
  73.         {
  74.             if (!$this->products->contains($product)) {
  75.                 $this->products->add($product);
  76.                 $product->setCondition($this);
  77.             }
  78.             return $this;
  79.         }
  80.         public function removeProduct(Product $product): static
  81.         {
  82.             if ($this->products->removeElement($product)) {
  83.                 // set the owning side to null (unless already changed)
  84.                 if ($product->getCondition() === $this) {
  85.                     $product->setCondition(null);
  86.                 }
  87.             }
  88.             return $this;
  89.         }
  90. }