app/Plugin/PiaProductReview/Entity/ProductReview.php line 29

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of PiaProductReview
  4.  *
  5.  * Copyright(c) Pia Staff. All Rights Reserved.
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Plugin\PiaProductReview\Entity;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Eccube\Entity\Product;
  13. /**
  14.  * ProductReview
  15.  *
  16.  * @ORM\Table(name="pia_product_review", indexes={
  17.  *     @ORM\Index(name="IDX_PIA_PRODUCT_REVIEW_PRODUCT_ID", columns={"product_id"}),
  18.  *     @ORM\Index(name="IDX_PIA_PRODUCT_REVIEW_VISIBLE", columns={"is_visible"}),
  19.  *     @ORM\Index(name="IDX_PIA_PRODUCT_REVIEW_CREATE_DATE", columns={"create_date"}),
  20.  *     @ORM\Index(name="IDX_PIA_PRODUCT_REVIEW_RATING", columns={"rating"})
  21.  * })
  22.  * @ORM\Entity(repositoryClass="Plugin\PiaProductReview\Repository\ProductReviewRepository")
  23.  * @ORM\HasLifecycleCallbacks()
  24.  */
  25. class ProductReview extends \Eccube\Entity\AbstractEntity
  26. {
  27.     /**
  28.      * @var int
  29.      *
  30.      * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  31.      * @ORM\Id
  32.      * @ORM\GeneratedValue(strategy="IDENTITY")
  33.      */
  34.     private $id;
  35.     /**
  36.      * @var string
  37.      *
  38.      * @ORM\Column(name="reviewer_name", type="string", length=100, nullable=false)
  39.      */
  40.     private $reviewer_name;
  41.     /**
  42.      * @var string|null
  43.      *
  44.      * @ORM\Column(name="reviewer_email", type="string", length=255, nullable=true)
  45.      */
  46.     private $reviewer_email;
  47.     /**
  48.      * @var int
  49.      *
  50.      * @ORM\Column(name="rating", type="smallint", nullable=false, options={"unsigned":true})
  51.      */
  52.     private $rating;
  53.     /**
  54.      * @var string|null
  55.      *
  56.      * @ORM\Column(name="comment", type="text", nullable=true)
  57.      */
  58.     private $comment;
  59.     /**
  60.      * @var string|null
  61.      *
  62.      * @ORM\Column(name="title", type="string", length=200, nullable=true)
  63.      */
  64.     private $title;
  65.     /**
  66.      * @var bool
  67.      *
  68.      * @ORM\Column(name="is_visible", type="boolean", options={"default":true})
  69.      */
  70.     private $is_visible true;
  71.     /**
  72.      * @var bool
  73.      *
  74.      * @ORM\Column(name="is_verified_purchase", type="boolean", options={"default":false})
  75.      */
  76.     private $is_verified_purchase false;
  77.     /**
  78.      * @var string|null
  79.      *
  80.      * @ORM\Column(name="reviewer_ip", type="string", length=45, nullable=true)
  81.      */
  82.     private $reviewer_ip;
  83.     /**
  84.      * @var string|null
  85.      *
  86.      * @ORM\Column(name="admin_memo", type="text", nullable=true)
  87.      */
  88.     private $admin_memo;
  89.     /**
  90.      * @var \DateTime
  91.      *
  92.      * @ORM\Column(name="create_date", type="datetimetz", nullable=false)
  93.      */
  94.     private $create_date;
  95.     /**
  96.      * @var \DateTime
  97.      *
  98.      * @ORM\Column(name="update_date", type="datetimetz", nullable=false)
  99.      */
  100.     private $update_date;
  101.     /**
  102.      * @var Product
  103.      *
  104.      * @ORM\ManyToOne(targetEntity="Eccube\Entity\Product")
  105.      * @ORM\JoinColumns({
  106.      *   @ORM\JoinColumn(name="product_id", referencedColumnName="id", onDelete="CASCADE", nullable=false)
  107.      * })
  108.      */
  109.     private $Product;
  110.     /**
  111.      * Get id.
  112.      *
  113.      * @return int
  114.      */
  115.     public function getId()
  116.     {
  117.         return $this->id;
  118.     }
  119.     /**
  120.      * Set reviewerName.
  121.      *
  122.      * @param string $reviewerName
  123.      *
  124.      * @return ProductReview
  125.      */
  126.     public function setReviewerName($reviewerName)
  127.     {
  128.         $this->reviewer_name $reviewerName;
  129.         return $this;
  130.     }
  131.     /**
  132.      * Get reviewerName.
  133.      *
  134.      * @return string
  135.      */
  136.     public function getReviewerName()
  137.     {
  138.         return $this->reviewer_name;
  139.     }
  140.     /**
  141.      * Set rating.
  142.      *
  143.      * @param int $rating
  144.      *
  145.      * @return ProductReview
  146.      */
  147.     public function setRating($rating)
  148.     {
  149.         $this->rating $rating;
  150.         return $this;
  151.     }
  152.     /**
  153.      * Get rating.
  154.      *
  155.      * @return int
  156.      */
  157.     public function getRating()
  158.     {
  159.         return $this->rating;
  160.     }
  161.     /**
  162.      * Set comment.
  163.      *
  164.      * @param string|null $comment
  165.      *
  166.      * @return ProductReview
  167.      */
  168.     public function setComment($comment null)
  169.     {
  170.         $this->comment $comment;
  171.         return $this;
  172.     }
  173.     /**
  174.      * Get comment.
  175.      *
  176.      * @return string|null
  177.      */
  178.     public function getComment()
  179.     {
  180.         return $this->comment;
  181.     }
  182.     /**
  183.      * Set isVisible.
  184.      *
  185.      * @param bool $isVisible
  186.      *
  187.      * @return ProductReview
  188.      */
  189.     public function setIsVisible($isVisible)
  190.     {
  191.         $this->is_visible $isVisible;
  192.         return $this;
  193.     }
  194.     /**
  195.      * Get isVisible.
  196.      *
  197.      * @return bool
  198.      */
  199.     public function getIsVisible()
  200.     {
  201.         return $this->is_visible;
  202.     }
  203.     /**
  204.      * Set createDate.
  205.      *
  206.      * @param \DateTime $createDate
  207.      *
  208.      * @return ProductReview
  209.      */
  210.     public function setCreateDate($createDate)
  211.     {
  212.         $this->create_date $createDate;
  213.         return $this;
  214.     }
  215.     /**
  216.      * Get createDate.
  217.      *
  218.      * @return \DateTime
  219.      */
  220.     public function getCreateDate()
  221.     {
  222.         return $this->create_date;
  223.     }
  224.     /**
  225.      * Set updateDate.
  226.      *
  227.      * @param \DateTime $updateDate
  228.      *
  229.      * @return ProductReview
  230.      */
  231.     public function setUpdateDate($updateDate)
  232.     {
  233.         $this->update_date $updateDate;
  234.         return $this;
  235.     }
  236.     /**
  237.      * Get updateDate.
  238.      *
  239.      * @return \DateTime
  240.      */
  241.     public function getUpdateDate()
  242.     {
  243.         return $this->update_date;
  244.     }
  245.     /**
  246.      * Set Product.
  247.      *
  248.      * @param Product|null $product
  249.      *
  250.      * @return ProductReview
  251.      */
  252.     public function setProduct(Product $product null)
  253.     {
  254.         $this->Product $product;
  255.         return $this;
  256.     }
  257.     /**
  258.      * Get Product.
  259.      *
  260.      * @return Product|null
  261.      */
  262.     public function getProduct()
  263.     {
  264.         return $this->Product;
  265.     }
  266.     /**
  267.      * Set reviewerEmail.
  268.      *
  269.      * @param string|null $reviewerEmail
  270.      *
  271.      * @return ProductReview
  272.      */
  273.     public function setReviewerEmail($reviewerEmail null)
  274.     {
  275.         $this->reviewer_email $reviewerEmail;
  276.         return $this;
  277.     }
  278.     /**
  279.      * Get reviewerEmail.
  280.      *
  281.      * @return string|null
  282.      */
  283.     public function getReviewerEmail()
  284.     {
  285.         return $this->reviewer_email;
  286.     }
  287.     /**
  288.      * Set title.
  289.      *
  290.      * @param string|null $title
  291.      *
  292.      * @return ProductReview
  293.      */
  294.     public function setTitle($title null)
  295.     {
  296.         $this->title $title;
  297.         return $this;
  298.     }
  299.     /**
  300.      * Get title.
  301.      *
  302.      * @return string|null
  303.      */
  304.     public function getTitle()
  305.     {
  306.         return $this->title;
  307.     }
  308.     /**
  309.      * Set isVerifiedPurchase.
  310.      *
  311.      * @param bool $isVerifiedPurchase
  312.      *
  313.      * @return ProductReview
  314.      */
  315.     public function setIsVerifiedPurchase($isVerifiedPurchase)
  316.     {
  317.         $this->is_verified_purchase $isVerifiedPurchase;
  318.         return $this;
  319.     }
  320.     /**
  321.      * Get isVerifiedPurchase.
  322.      *
  323.      * @return bool
  324.      */
  325.     public function getIsVerifiedPurchase()
  326.     {
  327.         return $this->is_verified_purchase;
  328.     }
  329.     /**
  330.      * Set reviewerIp.
  331.      *
  332.      * @param string|null $reviewerIp
  333.      *
  334.      * @return ProductReview
  335.      */
  336.     public function setReviewerIp($reviewerIp null)
  337.     {
  338.         $this->reviewer_ip $reviewerIp;
  339.         return $this;
  340.     }
  341.     /**
  342.      * Get reviewerIp.
  343.      *
  344.      * @return string|null
  345.      */
  346.     public function getReviewerIp()
  347.     {
  348.         return $this->reviewer_ip;
  349.     }
  350.     /**
  351.      * Set adminMemo.
  352.      *
  353.      * @param string|null $adminMemo
  354.      *
  355.      * @return ProductReview
  356.      */
  357.     public function setAdminMemo($adminMemo null)
  358.     {
  359.         $this->admin_memo $adminMemo;
  360.         return $this;
  361.     }
  362.     /**
  363.      * Get adminMemo.
  364.      *
  365.      * @return string|null
  366.      */
  367.     public function getAdminMemo()
  368.     {
  369.         return $this->admin_memo;
  370.     }
  371.     /**
  372.      * @ORM\PrePersist
  373.      */
  374.     public function prePersist()
  375.     {
  376.         $this->create_date = new \DateTime();
  377.         $this->update_date = new \DateTime();
  378.     }
  379.     /**
  380.      * @ORM\PreUpdate
  381.      */
  382.     public function preUpdate()
  383.     {
  384.         $this->update_date = new \DateTime();
  385.     }
  386. }