<?php
// src/Acme/UserBundle/Entity/User.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 Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @Doctrine\ORM\Mapping\Entity
* @Doctrine\ORM\Mapping\Table(name="product_recommendation")
*/
class ProductRecommendation implements BlameableInterface, TimestampableInterface, SoftDeletableInterface {
use BlameableTrait;
use TimestampableTrait;
use SoftDeletableTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @Doctrine\ORM\Mapping\ManyToOne(targetEntity="App\Entity\Product", inversedBy="recommendations")
* @Doctrine\ORM\Mapping\JoinColumn(name="product_id", referencedColumnName="id")
*/
private $product;
/**
* @Doctrine\ORM\Mapping\ManyToOne(targetEntity="App\Entity\Product")
* @Doctrine\ORM\Mapping\JoinColumn(name="accessory_id", referencedColumnName="id")
*/
private $recommendation;
/**
* To which locale recommendation is associated to
* @Doctrine\ORM\Mapping\ManyToMany(targetEntity="App\Entity\Language", cascade={"persist"})
*/
protected $languages;
public function __construct()
{
$this->languages = new ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set product
*
* @param \App\Entity\Product $product
*
* @return ProductRecommendation
*/
public function setProduct(\App\Entity\Product $product = null)
{
$this->product = $product;
return $this;
}
/**
* Get product
*
* @return \App\Entity\Product
*/
public function getProduct()
{
return $this->product;
}
/**
* Set recommendation
*
* @param \App\Entity\Product $recommendation
*
* @return ProductRecommendation
*/
public function setRecommendation(\App\Entity\Product $recommendation = null)
{
$this->recommendation = $recommendation;
return $this;
}
/**
* Get recommendation
*
* @return \App\Entity\Product
*/
public function getRecommendation()
{
return $this->recommendation;
}
/**
* @return Collection|Language[]
*/
public function getLanguages(): Collection
{
return $this->languages;
}
public function addLanguage(Language $language): self
{
if (!$this->languages->contains($language)) {
$this->languages[] = $language;
}
return $this;
}
public function removeLanguage(Language $language): self
{
if ($this->languages->contains($language)) {
$this->languages->removeElement($language);
}
return $this;
}
}