app/Plugin/ProductReview4/Entity/ProductReview.php line 31

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Plugin\ProductReview4\Entity;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Eccube\Annotation as Eccube;
  15. use Eccube\Annotation\EntityExtension;
  16. use Eccube\Entity\AbstractEntity;
  17. use Eccube\Entity\Customer;
  18. use Eccube\Entity\Master\Sex;
  19. use Eccube\Entity\Product;
  20. /**
  21.  * ProductReview
  22.  *
  23.  * @ORM\Table(name="plg_product_review")
  24.  * @ORM\Entity(repositoryClass="Plugin\ProductReview4\Repository\ProductReviewRepository")
  25.  */
  26. class ProductReview extends AbstractEntity
  27. {
  28.     /**
  29.      * @var int
  30.      *
  31.      * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  32.      * @ORM\Id
  33.      * @ORM\GeneratedValue(strategy="IDENTITY")
  34.      */
  35.     private $id;
  36.     /**
  37.      * @var string
  38.      *
  39.      * @ORM\Column(name="reviewer_name", type="string")
  40.      */
  41.     private $reviewer_name;
  42.     /**
  43.      * @var string
  44.      *
  45.      * @ORM\Column(name="reviewer_url", type="text", nullable=true)
  46.      */
  47.     private $reviewer_url;
  48.     /**
  49.      * @var string
  50.      *
  51.      * @ORM\Column(name="title", type="string", length=50)
  52.      */
  53.     private $title;
  54.     /**
  55.      * @var string
  56.      *
  57.      * @ORM\Column(name="comment", type="text")
  58.      */
  59.     private $comment;
  60.     /**
  61.      * @var Sex
  62.      *
  63.      * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Sex")
  64.      * @ORM\JoinColumns({
  65.      *   @ORM\JoinColumn(name="sex_id", referencedColumnName="id")
  66.      * })
  67.      */
  68.     private $Sex;
  69.     /**
  70.      * @var int
  71.      *
  72.      * @ORM\Column(name="recommend_level", type="smallint")
  73.      */
  74.     private $recommend_level;
  75.     /**
  76.      * @var Product
  77.      *
  78.      * @ORM\ManyToOne(targetEntity="Eccube\Entity\Product")
  79.      * @ORM\JoinColumns({
  80.      *   @ORM\JoinColumn(name="product_id", referencedColumnName="id")
  81.      * })
  82.      */
  83.     private $Product;
  84.     /**
  85.      * @var Customer
  86.      *
  87.      * @ORM\ManyToOne(targetEntity="Eccube\Entity\Customer")
  88.      * @ORM\JoinColumns({
  89.      *   @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
  90.      * })
  91.      */
  92.     private $Customer;
  93.     /**
  94.      * @var \DateTime
  95.      *
  96.      * @ORM\Column(name="create_date", type="datetimetz")
  97.      */
  98.     private $create_date;
  99.     /**
  100.      * @var \DateTime
  101.      *
  102.      * @ORM\Column(name="update_date", type="datetimetz")
  103.      */
  104.     private $update_date;
  105.     /**
  106.      * @var \Plugin\ProductReview4\Entity\ProductReviewStatus
  107.      *
  108.      * @ORM\ManyToOne(targetEntity="Plugin\ProductReview4\Entity\ProductReviewStatus")
  109.      * @ORM\JoinColumns({
  110.      *   @ORM\JoinColumn(name="status_id", referencedColumnName="id")
  111.      * })
  112.      */
  113.     private $Status;
  114.     /**
  115.      * Get id.
  116.      *
  117.      * @return int
  118.      */
  119.     public function getId()
  120.     {
  121.         return $this->id;
  122.     }
  123.     /**
  124.      * Get reviewer_name.
  125.      *
  126.      * @return string
  127.      */
  128.     public function getReviewerName()
  129.     {
  130.         return $this->reviewer_name;
  131.     }
  132.     /**
  133.      * Set reviewer_name.
  134.      *
  135.      * @param string $reviewer_name
  136.      *
  137.      * @return ProductReview
  138.      */
  139.     public function setReviewerName($reviewer_name)
  140.     {
  141.         $this->reviewer_name $reviewer_name;
  142.         return $this;
  143.     }
  144.     /**
  145.      * Get reviewer_url.
  146.      *
  147.      * @return string
  148.      */
  149.     public function getReviewerUrl()
  150.     {
  151.         return $this->reviewer_url;
  152.     }
  153.     /**
  154.      * Set reviewer_url.
  155.      *
  156.      * @param string $reviewer_url
  157.      *
  158.      * @return ProductReview
  159.      */
  160.     public function setReviewerUrl($reviewer_url)
  161.     {
  162.         $this->reviewer_url $reviewer_url;
  163.         return $this;
  164.     }
  165.     /**
  166.      * Get recommend_level.
  167.      *
  168.      * @return int
  169.      */
  170.     public function getRecommendLevel()
  171.     {
  172.         return $this->recommend_level;
  173.     }
  174.     /**
  175.      * Set recommend_level.
  176.      *
  177.      * @param int $recommend_level
  178.      *
  179.      * @return ProductReview
  180.      */
  181.     public function setRecommendLevel($recommend_level)
  182.     {
  183.         $this->recommend_level $recommend_level;
  184.         return $this;
  185.     }
  186.     /**
  187.      * Set Sex.
  188.      *
  189.      * @param Sex $Sex
  190.      *
  191.      * @return ProductReview
  192.      */
  193.     public function setSex(Sex $Sex null)
  194.     {
  195.         $this->Sex $Sex;
  196.         return $this;
  197.     }
  198.     /**
  199.      * Get Sex.
  200.      *
  201.      * @return Sex
  202.      */
  203.     public function getSex()
  204.     {
  205.         return $this->Sex;
  206.     }
  207.     /**
  208.      * Get title.
  209.      *
  210.      * @return string
  211.      */
  212.     public function getTitle()
  213.     {
  214.         return $this->title;
  215.     }
  216.     /**
  217.      * Set title.
  218.      *
  219.      * @param string $title
  220.      *
  221.      * @return ProductReview
  222.      */
  223.     public function setTitle($title)
  224.     {
  225.         $this->title $title;
  226.         return $this;
  227.     }
  228.     /**
  229.      * Get comment.
  230.      *
  231.      * @return string
  232.      */
  233.     public function getComment()
  234.     {
  235.         return $this->comment;
  236.     }
  237.     /**
  238.      * Set comment.
  239.      *
  240.      * @param string $comment
  241.      *
  242.      * @return ProductReview
  243.      */
  244.     public function setComment($comment)
  245.     {
  246.         $this->comment $comment;
  247.         return $this;
  248.     }
  249.     /**
  250.      * Set Product.
  251.      *
  252.      * @param Product $Product
  253.      *
  254.      * @return $this
  255.      */
  256.     public function setProduct(Product $Product)
  257.     {
  258.         $this->Product $Product;
  259.         return $this;
  260.     }
  261.     /**
  262.      * Get Product.
  263.      *
  264.      * @return Product
  265.      */
  266.     public function getProduct()
  267.     {
  268.         return $this->Product;
  269.     }
  270.     /**
  271.      * Set Customer.
  272.      *
  273.      * @param Customer $Customer
  274.      *
  275.      * @return $this
  276.      */
  277.     public function setCustomer(Customer $Customer)
  278.     {
  279.         $this->Customer $Customer;
  280.         return $this;
  281.     }
  282.     /**
  283.      * Get Customer.
  284.      *
  285.      * @return Customer
  286.      */
  287.     public function getCustomer()
  288.     {
  289.         return $this->Customer;
  290.     }
  291.     /**
  292.      * @return \Plugin\ProductReview4\Entity\ProductReviewStatus
  293.      */
  294.     public function getStatus()
  295.     {
  296.         return $this->Status;
  297.     }
  298.     /**
  299.      * @param \Plugin\ProductReview4\Entity\ProductReviewStatus $status
  300.      */
  301.     public function setStatus(\Plugin\ProductReview4\Entity\ProductReviewStatus $Status)
  302.     {
  303.         $this->Status $Status;
  304.     }
  305.     /**
  306.      * Set create_date.
  307.      *
  308.      * @param \DateTime $createDate
  309.      *
  310.      * @return $this
  311.      */
  312.     public function setCreateDate($createDate)
  313.     {
  314.         $this->create_date $createDate;
  315.         return $this;
  316.     }
  317.     /**
  318.      * Get create_date.
  319.      *
  320.      * @return \DateTime
  321.      */
  322.     public function getCreateDate()
  323.     {
  324.         return $this->create_date;
  325.     }
  326.     /**
  327.      * Set update_date.
  328.      *
  329.      * @param \DateTime $updateDate
  330.      *
  331.      * @return $this
  332.      */
  333.     public function setUpdateDate($updateDate)
  334.     {
  335.         $this->update_date $updateDate;
  336.         return $this;
  337.     }
  338.     /**
  339.      * Get update_date.
  340.      *
  341.      * @return \DateTime
  342.      */
  343.     public function getUpdateDate()
  344.     {
  345.         return $this->update_date;
  346.     }
  347.     
  348.     
  349.     /**
  350.      * @ORM\Column(type="string", length=255, nullable=true)
  351.      */
  352.     private $product_file1;
  353.     
  354.     public function getProductFile1(){
  355.       return $this->product_file1;
  356.     }
  357.     public function setProductFile1($filename){
  358.       $this->product_file1 $filename;
  359.       return $this;
  360.     }
  361.     
  362.     /**
  363.      * @ORM\Column(type="string", length=255, nullable=true)
  364.      */
  365.     private $product_class_category1;
  366.     
  367.     public function getProductClassCategory1(){
  368.       return $this->product_class_category1;
  369.     }
  370.     public function setProductClassCategory1($product_class_category1){
  371.       $this->product_class_category1 $product_class_category1;
  372.       return $this;
  373.     }
  374.     
  375.     /**
  376.      * @ORM\Column(type="string", length=255, nullable=true)
  377.      */
  378.     private $product_class_category2;
  379.     
  380.     public function getProductClassCategory2(){
  381.       return $this->product_class_category2;
  382.     }
  383.     public function setProductClassCategory2($product_class_category2){
  384.       $this->product_class_category2 $product_class_category2;
  385.       return $this;
  386.     }
  387.     
  388.     /**
  389.      * @ORM\Column(type="integer", length=11, nullable=true)
  390.      */
  391.     private $product_quantity;
  392.     
  393.     public function getProductQuantity(){
  394.       return $this->product_quantity;
  395.     }
  396.     public function setProductQuantity($product_quantity){
  397.       $this->product_quantity $product_quantity;
  398.       return $this;
  399.     }
  400.     
  401.     /**
  402.      * @ORM\Column(type="integer", length=11, nullable=true)
  403.      */
  404.     private $gift_send;
  405.     
  406.     public function getGiftSend(){
  407.       return $this->gift_send;
  408.     }
  409.     public function setGiftSend($gift_send){
  410.       $this->gift_send $gift_send;
  411.       return $this;
  412.     }
  413.     
  414.     
  415.     public function getStarHtml1(){
  416.       
  417.       $reco $this->getRecommendLevel();
  418.       
  419.       $html '';
  420.       for($i=0;$i<$reco;$i++){
  421.         $html .= '<li><i class="fa-solid fa-star"></i></li>';
  422.       }
  423.       for(;$i<5;$i++){
  424.         $html .= '<li class="empty"><i class="fa-solid fa-star"></i></li>';
  425.       }
  426.       
  427.       return $html;
  428.     }
  429.     
  430. }