<?php
/*
* This file is part of PiaProductReview
*
* Copyright(c) Pia Staff. All Rights Reserved.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Plugin\PiaProductReview\Entity;
use Doctrine\ORM\Mapping as ORM;
use Eccube\Entity\Product;
/**
* ProductReview
*
* @ORM\Table(name="pia_product_review", indexes={
* @ORM\Index(name="IDX_PIA_PRODUCT_REVIEW_PRODUCT_ID", columns={"product_id"}),
* @ORM\Index(name="IDX_PIA_PRODUCT_REVIEW_VISIBLE", columns={"is_visible"}),
* @ORM\Index(name="IDX_PIA_PRODUCT_REVIEW_CREATE_DATE", columns={"create_date"}),
* @ORM\Index(name="IDX_PIA_PRODUCT_REVIEW_RATING", columns={"rating"})
* })
* @ORM\Entity(repositoryClass="Plugin\PiaProductReview\Repository\ProductReviewRepository")
* @ORM\HasLifecycleCallbacks()
*/
class ProductReview extends \Eccube\Entity\AbstractEntity
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", options={"unsigned":true})
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="reviewer_name", type="string", length=100, nullable=false)
*/
private $reviewer_name;
/**
* @var string|null
*
* @ORM\Column(name="reviewer_email", type="string", length=255, nullable=true)
*/
private $reviewer_email;
/**
* @var int
*
* @ORM\Column(name="rating", type="smallint", nullable=false, options={"unsigned":true})
*/
private $rating;
/**
* @var string|null
*
* @ORM\Column(name="comment", type="text", nullable=true)
*/
private $comment;
/**
* @var string|null
*
* @ORM\Column(name="title", type="string", length=200, nullable=true)
*/
private $title;
/**
* @var bool
*
* @ORM\Column(name="is_visible", type="boolean", options={"default":true})
*/
private $is_visible = true;
/**
* @var bool
*
* @ORM\Column(name="is_verified_purchase", type="boolean", options={"default":false})
*/
private $is_verified_purchase = false;
/**
* @var string|null
*
* @ORM\Column(name="reviewer_ip", type="string", length=45, nullable=true)
*/
private $reviewer_ip;
/**
* @var string|null
*
* @ORM\Column(name="admin_memo", type="text", nullable=true)
*/
private $admin_memo;
/**
* @var \DateTime
*
* @ORM\Column(name="create_date", type="datetimetz", nullable=false)
*/
private $create_date;
/**
* @var \DateTime
*
* @ORM\Column(name="update_date", type="datetimetz", nullable=false)
*/
private $update_date;
/**
* @var Product
*
* @ORM\ManyToOne(targetEntity="Eccube\Entity\Product")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="product_id", referencedColumnName="id", onDelete="CASCADE", nullable=false)
* })
*/
private $Product;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set reviewerName.
*
* @param string $reviewerName
*
* @return ProductReview
*/
public function setReviewerName($reviewerName)
{
$this->reviewer_name = $reviewerName;
return $this;
}
/**
* Get reviewerName.
*
* @return string
*/
public function getReviewerName()
{
return $this->reviewer_name;
}
/**
* Set rating.
*
* @param int $rating
*
* @return ProductReview
*/
public function setRating($rating)
{
$this->rating = $rating;
return $this;
}
/**
* Get rating.
*
* @return int
*/
public function getRating()
{
return $this->rating;
}
/**
* Set comment.
*
* @param string|null $comment
*
* @return ProductReview
*/
public function setComment($comment = null)
{
$this->comment = $comment;
return $this;
}
/**
* Get comment.
*
* @return string|null
*/
public function getComment()
{
return $this->comment;
}
/**
* Set isVisible.
*
* @param bool $isVisible
*
* @return ProductReview
*/
public function setIsVisible($isVisible)
{
$this->is_visible = $isVisible;
return $this;
}
/**
* Get isVisible.
*
* @return bool
*/
public function getIsVisible()
{
return $this->is_visible;
}
/**
* Set createDate.
*
* @param \DateTime $createDate
*
* @return ProductReview
*/
public function setCreateDate($createDate)
{
$this->create_date = $createDate;
return $this;
}
/**
* Get createDate.
*
* @return \DateTime
*/
public function getCreateDate()
{
return $this->create_date;
}
/**
* Set updateDate.
*
* @param \DateTime $updateDate
*
* @return ProductReview
*/
public function setUpdateDate($updateDate)
{
$this->update_date = $updateDate;
return $this;
}
/**
* Get updateDate.
*
* @return \DateTime
*/
public function getUpdateDate()
{
return $this->update_date;
}
/**
* Set Product.
*
* @param Product|null $product
*
* @return ProductReview
*/
public function setProduct(Product $product = null)
{
$this->Product = $product;
return $this;
}
/**
* Get Product.
*
* @return Product|null
*/
public function getProduct()
{
return $this->Product;
}
/**
* Set reviewerEmail.
*
* @param string|null $reviewerEmail
*
* @return ProductReview
*/
public function setReviewerEmail($reviewerEmail = null)
{
$this->reviewer_email = $reviewerEmail;
return $this;
}
/**
* Get reviewerEmail.
*
* @return string|null
*/
public function getReviewerEmail()
{
return $this->reviewer_email;
}
/**
* Set title.
*
* @param string|null $title
*
* @return ProductReview
*/
public function setTitle($title = null)
{
$this->title = $title;
return $this;
}
/**
* Get title.
*
* @return string|null
*/
public function getTitle()
{
return $this->title;
}
/**
* Set isVerifiedPurchase.
*
* @param bool $isVerifiedPurchase
*
* @return ProductReview
*/
public function setIsVerifiedPurchase($isVerifiedPurchase)
{
$this->is_verified_purchase = $isVerifiedPurchase;
return $this;
}
/**
* Get isVerifiedPurchase.
*
* @return bool
*/
public function getIsVerifiedPurchase()
{
return $this->is_verified_purchase;
}
/**
* Set reviewerIp.
*
* @param string|null $reviewerIp
*
* @return ProductReview
*/
public function setReviewerIp($reviewerIp = null)
{
$this->reviewer_ip = $reviewerIp;
return $this;
}
/**
* Get reviewerIp.
*
* @return string|null
*/
public function getReviewerIp()
{
return $this->reviewer_ip;
}
/**
* Set adminMemo.
*
* @param string|null $adminMemo
*
* @return ProductReview
*/
public function setAdminMemo($adminMemo = null)
{
$this->admin_memo = $adminMemo;
return $this;
}
/**
* Get adminMemo.
*
* @return string|null
*/
public function getAdminMemo()
{
return $this->admin_memo;
}
/**
* @ORM\PrePersist
*/
public function prePersist()
{
$this->create_date = new \DateTime();
$this->update_date = new \DateTime();
}
/**
* @ORM\PreUpdate
*/
public function preUpdate()
{
$this->update_date = new \DateTime();
}
}