app/Customize/Entity/CartItemTrait.php line 76

Open in your IDE?
  1. <?php
  2. namespace Customize\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Eccube\Annotation\EntityExtension;
  5. use Lm\Engine\EC\Entity\GoodsExtended;
  6. /**
  7.  * @EntityExtension("Eccube\Entity\CartItem")
  8.  */
  9. trait CartItemTrait
  10. {
  11.     /**
  12.      * @ORM\Column(name="options", type="text", nullable=true)
  13.      */
  14.     public $options;
  15.     /**
  16.      * @ORM\Column(name="estimate_id", type="integer", nullable=true, options={"default":0, "unsigned": true})
  17.      */
  18.     public $EstimateId;
  19.     /**
  20.      * Get options
  21.      *
  22.      * @return string options
  23.      */
  24.     public function getOptions()
  25.     {
  26.         return $this->options;
  27.     }
  28.     /**
  29.      * Set options
  30.      *
  31.      * @return $this
  32.      */
  33.     public function setOptions($options)
  34.     {
  35.         $this->options $options;
  36.         return $this;
  37.     }
  38.     /**
  39.      * Get EstimateId
  40.      *
  41.      * @return int
  42.      */
  43.     public function getEstimateId()
  44.     {
  45.         return $this->EstimateId;
  46.     }
  47.     /**
  48.      * Set EstimateId
  49.      *
  50.      * @return $this
  51.      */
  52.     public function setEstimateId($EstimateId)
  53.     {
  54.         if (!empty($this->getOptions()) && (int)$EstimateId === 0) {
  55.             try {
  56.                 throw new \Exception('[LM] #1121 - Trying set 0 to CartItem.estimateId');
  57.             } catch(\Exception $e) {
  58.                 log_error($e->getMessage(), [
  59.                     'Message' => $e->getMessage(),
  60.                     'File' => $e->getFile(),
  61.                     'Line' => $e->getLine(),
  62.                     'TraceAsString' => $e->getTraceAsString(),
  63.                     '$_POST' => $_POST,
  64.                     '$_SERVER' => $_SERVER,
  65.                     '$_SESSION' => $_SESSION,
  66.                 ]);
  67.             }
  68.         }
  69.         $this->EstimateId $EstimateId;
  70.         return $this;
  71.     }
  72.     public function getOptionsData()
  73.     {
  74.         return json_decode($this->getOptions(), true);
  75.     }
  76.     public function isSusoage()
  77.     {
  78.         return ($options $this->getOptionsData()) && !empty($options['susoage']);
  79.     }
  80.     public function isNairePrint()
  81.     {
  82.         return ($options $this->getOptionsData()) && !empty($options['print']);
  83.     }
  84.     public function isKyouei()
  85.     {
  86.         return GoodsExtended::createByJanId($this->getProductClass()->getId())
  87.             ->isKyouei()
  88.         ;
  89.     }
  90.     public function isKyoueiWithNairePrint()
  91.     {
  92.         return $this->isKyouei() && $this->isNairePrint();
  93.     }
  94. }