src/AtechNet/CoreBundle/Entity/Review.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\AtechNet\CoreBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping\Column;
  5. use Doctrine\ORM\Mapping\Entity;
  6. use Doctrine\ORM\Mapping\JoinColumn;
  7. use Doctrine\ORM\Mapping\ManyToOne;
  8. use Doctrine\ORM\Mapping\OneToMany;
  9. use Doctrine\ORM\Mapping\Table as Table;
  10. /**
  11.  * Review
  12.  *
  13.  * @Table(name="reviews")
  14.  * @Entity(repositoryClass="App\AtechNet\CoreBundle\Repository\ReviewRepository")
  15.  */
  16. class Review extends AbstractSignedEntity
  17. {
  18.     public const TYPE_WEB = 1;
  19.     public const TYPE_PRODUCT = 2;
  20.     /**
  21.      * @return array
  22.      */
  23.     public static function getTypeChoices()
  24.     {
  25.         return [
  26.             self::TYPE_WEB => 'web',
  27.             self::TYPE_PRODUCT => 'product',
  28.         ];
  29.     }
  30.     /**
  31.      * @var int
  32.      *
  33.      * @Column(name="type", type="integer")
  34.      */
  35.     private $type;
  36.     /**
  37.      * @var Language
  38.      *
  39.      * @ManyToOne(targetEntity="Language")
  40.      * @JoinColumn(name="language_id", referencedColumnName="id", nullable=false)
  41.      */
  42.     private $language;
  43.     /**
  44.      * @var string
  45.      *
  46.      * @Column(name="name", type="string", length=255, nullable=true)
  47.      */
  48.     private $name;
  49.     /**
  50.      * @var string
  51.      *
  52.      * @Column(name="text", type="text", nullable=true)
  53.      */
  54.     private $text;
  55.     /**
  56.      * @var int
  57.      *
  58.      * @Column(name="stars", type="integer")
  59.      */
  60.     private $stars;
  61.     /**
  62.      * @var bool
  63.      *
  64.      * @Column(name="approved", type="boolean")
  65.      */
  66.     private $approved = false;
  67.     /**
  68.      * @var bool
  69.      *
  70.      * @Column(name="show_at_homepage", type="boolean")
  71.      */
  72.     private $showAtHomepage = false;
  73.     /**
  74.      * @var Product
  75.      *
  76.      * @ManyToOne(targetEntity="Product")
  77.      * @JoinColumn(name="product_id", referencedColumnName="id", nullable=true)
  78.      */
  79.     private $product;
  80.     /**
  81.      * @var ArrayCollection
  82.      *
  83.      * @OneToMany(targetEntity="ReviewSurveyMedia", mappedBy="review")
  84.      **/
  85.     private $surveyMedias;
  86.     /**
  87.      * @var Customer
  88.      *
  89.      * @ManyToOne(targetEntity="Customer", inversedBy="reviews")
  90.      * @JoinColumn(name="customer_id", referencedColumnName="id", nullable=true)
  91.      */
  92.     private $customer;
  93.     /**
  94.      * @var Order
  95.      *
  96.      * @ManyToOne(targetEntity="Order")
  97.      * @JoinColumn(name="order_id", referencedColumnName="id", nullable=true)
  98.      */
  99.     private $order;
  100.     /**
  101.      * @return int
  102.      */
  103.     public function getType()
  104.     {
  105.         return $this->type;
  106.     }
  107.     /**
  108.      * @param int $type
  109.      */
  110.     public function setType($type)
  111.     {
  112.         $this->type = $type;
  113.     }
  114.     /**
  115.      * @return Language
  116.      */
  117.     public function getLanguage()
  118.     {
  119.         return $this->language;
  120.     }
  121.     /**
  122.      * @param Language $language
  123.      */
  124.     public function setLanguage($language)
  125.     {
  126.         $this->language = $language;
  127.     }
  128.     /**
  129.      * @return string
  130.      */
  131.     public function getName()
  132.     {
  133.         return $this->name;
  134.     }
  135.     /**
  136.      * @param string $name
  137.      */
  138.     public function setName($name)
  139.     {
  140.         $this->name = $name;
  141.     }
  142.     /**
  143.      * @return string
  144.      */
  145.     public function getText()
  146.     {
  147.         return $this->text;
  148.     }
  149.     /**
  150.      * @param string $text
  151.      */
  152.     public function setText($text)
  153.     {
  154.         $this->text = $text;
  155.     }
  156.     /**
  157.      * @return int
  158.      */
  159.     public function getStars()
  160.     {
  161.         return $this->stars;
  162.     }
  163.     /**
  164.      * @param int $stars
  165.      */
  166.     public function setStars($stars)
  167.     {
  168.         $this->stars = $stars;
  169.     }
  170.     /**
  171.      * @return bool
  172.      */
  173.     public function isApproved()
  174.     {
  175.         return $this->approved;
  176.     }
  177.     /**
  178.      * @param bool $approved
  179.      */
  180.     public function setApproved($approved)
  181.     {
  182.         $this->approved = $approved;
  183.     }
  184.     /**
  185.      * @return bool
  186.      */
  187.     public function isShowAtHomepage()
  188.     {
  189.         return $this->showAtHomepage;
  190.     }
  191.     /**
  192.      * @param bool $showAtHomepage
  193.      */
  194.     public function setShowAtHomepage($showAtHomepage)
  195.     {
  196.         $this->showAtHomepage = $showAtHomepage;
  197.     }
  198.     /**
  199.      * @return Product
  200.      */
  201.     public function getProduct()
  202.     {
  203.         return $this->product;
  204.     }
  205.     /**
  206.      * @param Product $product
  207.      */
  208.     public function setProduct($product)
  209.     {
  210.         $this->product = $product;
  211.     }
  212.     /**
  213.      * @return ArrayCollection
  214.      */
  215.     public function getSurveyMedias()
  216.     {
  217.         return $this->surveyMedias;
  218.     }
  219.     /**
  220.      * @return Customer
  221.      */
  222.     public function getCustomer()
  223.     {
  224.         return $this->customer;
  225.     }
  226.     /**
  227.      * @param Customer $customer
  228.      */
  229.     public function setCustomer($customer)
  230.     {
  231.         $this->customer = $customer;
  232.     }
  233.     /**
  234.      * @return Order|null
  235.      */
  236.     public function getOrder(): ?Order
  237.     {
  238.         return $this->order;
  239.     }
  240.     /**
  241.      * @param Order|null $order
  242.      */
  243.     public function setOrder(?Order $order): void
  244.     {
  245.         $this->order = $order;
  246.     }
  247. }