src/Entity/ProductRecommendation.php line 29

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 Doctrine\Common\Collections\ArrayCollection;
  11. use Doctrine\Common\Collections\Collection;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  15. /**
  16.  * @Doctrine\ORM\Mapping\Entity
  17.  * @Doctrine\ORM\Mapping\Table(name="product_recommendation")
  18.  */
  19. class ProductRecommendation implements BlameableInterfaceTimestampableInterfaceSoftDeletableInterface  {
  20.     use BlameableTrait;
  21.     use TimestampableTrait;
  22.     
  23.     use SoftDeletableTrait;
  24.     
  25. /**
  26.      * @var integer
  27.      *
  28.      * @ORM\Column(name="id", type="integer", nullable=false)
  29.      * @ORM\Id
  30.      * @ORM\GeneratedValue(strategy="IDENTITY")
  31.      */
  32.     private $id;
  33.     /**
  34.      * @Doctrine\ORM\Mapping\ManyToOne(targetEntity="App\Entity\Product", inversedBy="recommendations")
  35.      * @Doctrine\ORM\Mapping\JoinColumn(name="product_id", referencedColumnName="id")
  36.      */
  37.     private $product;
  38.     /**
  39.      * @Doctrine\ORM\Mapping\ManyToOne(targetEntity="App\Entity\Product")
  40.      * @Doctrine\ORM\Mapping\JoinColumn(name="accessory_id", referencedColumnName="id")
  41.      */
  42.     private $recommendation;
  43.     /**
  44.      * To which locale recommendation is associated to
  45.      * @Doctrine\ORM\Mapping\ManyToMany(targetEntity="App\Entity\Language", cascade={"persist"})
  46.      */
  47.     protected $languages;
  48.     public function __construct()
  49.     {
  50.         $this->languages = new ArrayCollection();
  51.     }
  52.     /**
  53.      * Get id
  54.      *
  55.      * @return integer
  56.      */
  57.     public function getId()
  58.     {
  59.         return $this->id;
  60.     }
  61.     /**
  62.      * Set product
  63.      *
  64.      * @param \App\Entity\Product $product
  65.      *
  66.      * @return ProductRecommendation
  67.      */
  68.     public function setProduct(\App\Entity\Product $product null)
  69.     {
  70.         $this->product $product;
  71.         return $this;
  72.     }
  73.     /**
  74.      * Get product
  75.      *
  76.      * @return \App\Entity\Product
  77.      */
  78.     public function getProduct()
  79.     {
  80.         return $this->product;
  81.     }
  82.     /**
  83.      * Set recommendation
  84.      *
  85.      * @param \App\Entity\Product $recommendation
  86.      *
  87.      * @return ProductRecommendation
  88.      */
  89.     public function setRecommendation(\App\Entity\Product $recommendation null)
  90.     {
  91.         $this->recommendation $recommendation;
  92.         return $this;
  93.     }
  94.     /**
  95.      * Get recommendation
  96.      *
  97.      * @return \App\Entity\Product
  98.      */
  99.     public function getRecommendation()
  100.     {
  101.         return $this->recommendation;
  102.     }
  103.     /**
  104.      * @return Collection|Language[]
  105.      */
  106.     public function getLanguages(): Collection
  107.     {
  108.         return $this->languages;
  109.     }
  110.     public function addLanguage(Language $language): self
  111.     {
  112.         if (!$this->languages->contains($language)) {
  113.             $this->languages[] = $language;
  114.         }
  115.         return $this;
  116.     }
  117.     public function removeLanguage(Language $language): self
  118.     {
  119.         if ($this->languages->contains($language)) {
  120.             $this->languages->removeElement($language);
  121.         }
  122.         return $this;
  123.     }
  124. }