app/Plugin/GtmGaEEc42/Entity/GtmGaEEc.php line 582

Open in your IDE?
  1. <?php
  2. /*
  3.  * GtmGaEEc42: GTM版 Google Analytics eコマース/拡張eコマース対応プラグイン
  4.  * Copyright (C) 2017-2022 Freischtide Inc. All Rights Reserved.
  5.  * http://freischtide.tumblr.com/
  6.  *
  7.  * License: see LICENSE.txt
  8.  */
  9. namespace Plugin\GtmGaEEc42\Entity;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Eccube\Entity\AbstractEntity;
  12. /**
  13.  * GtmGaEEc
  14.  *
  15.  * @ORM\Table(name="plg_gtmgaeec_plugin")
  16.  * @ORM\InheritanceType("SINGLE_TABLE")
  17.  * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  18.  * @ORM\HasLifecycleCallbacks()
  19.  * @ORM\Entity(repositoryClass="Plugin\GtmGaEEc42\Repository\GtmGaEEcRepository")
  20.  */
  21. class GtmGaEEc extends AbstractEntity
  22. {
  23.     const GTMGAEEC_TAG_UA 1;
  24.     const GTMGAEEC_TAG_GA4 2;
  25.     const GTMGAEEC_USE_EEC 1;
  26.     const GTMGAEEC_USE_EC 2;
  27.     const GTMGAEEC_USE_GTM_TAG 1;
  28.     const GTMGAEEC_USE_NO_GTM_TAG 2;
  29.     const GTMGAEEC_OP_CATEGORY_ON 1;
  30.     const GTMGAEEC_OP_CATEGORY_OFF 2;
  31.     const GTMGAEEC_OP_WITH_VARIANT 1;
  32.     const GTMGAEEC_OP_WITHOUT_VARIANT 2;
  33.     const GTMGAEEC_OP_INCLUDE_USER_ID 1;
  34.     const GTMGAEEC_OP_NOT_INCLUDE_USER_ID 2;
  35.     const GTMGAEEC_OP_WITH_USER_TIMINGS 1;
  36.     const GTMGAEEC_OP_WITHOUT_USER_TIMINGS 2;
  37.     const GTMGAEEC_OP_WITH_IMP_TRACK 1;
  38.     const GTMGAEEC_OP_WITHOUT_IMP_TRACK 2;
  39.     const GTMGAEEC_OP_CONFIRMATION_AS_PURCHASE 1;
  40.     const GTMGAEEC_OP_NOT_CONFIRMATION_AS_PURCHASE 2;
  41.     const GTMGAEEC_OP_USE_CUSTOM_REFERRER 1;
  42.     const GTMGAEEC_OP_NOT_USE_CUSTOM_REFERRER 2;
  43.     /**
  44.      * @ORM\PostLoad
  45.      */
  46.     public function init()
  47.     {
  48.         $this->getCustomReferrers();
  49.     }
  50.     /**
  51.      * @var int
  52.      *
  53.      * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  54.      * @ORM\Id
  55.      * @ORM\GeneratedValue(strategy="IDENTITY")
  56.      */
  57.     private $id;
  58.     /**
  59.      * @var string
  60.      *
  61.      * @ORM\Column(name="tid", type="string", nullable=true, length=255)
  62.      */
  63.     private $tid;
  64.     /**
  65.      * @var int
  66.      *
  67.      * @ORM\Column(name="tag_version", type="smallint", nullable=false, options={"unsigned":false, "default":1})
  68.      */
  69.     private $tag_version self::GTMGAEEC_TAG_UA;
  70.     /**
  71.      * @var int
  72.      *
  73.      * @ORM\Column(name="eec", type="smallint", nullable=false, options={"unsigned":false, "default":1})
  74.      */
  75.     private $eec self::GTMGAEEC_USE_EEC;
  76.     /**
  77.      * @var int
  78.      *
  79.      * @ORM\Column(name="tag", type="smallint", nullable=false, options={"unsigned":false, "default":1})
  80.      */
  81.     private $tag self::GTMGAEEC_USE_GTM_TAG;
  82.     /**
  83.      * @var int
  84.      *
  85.      * @ORM\Column(name="category", type="smallint", nullable=false, options={"unsigned":false, "default":1})
  86.      */
  87.     private $category self::GTMGAEEC_OP_CATEGORY_ON;
  88.     /**
  89.      * @var int
  90.      *
  91.      * @ORM\Column(name="include_variant", type="smallint", nullable=false, options={"unsigned":false, "default":2})
  92.      */
  93.     private $include_variant self::GTMGAEEC_OP_WITHOUT_VARIANT;
  94.     /**
  95.      * @var int
  96.      *
  97.      * @ORM\Column(name="track_user_id", type="smallint", nullable=false, options={"unsigned":false, "default":2})
  98.      */
  99.     private $track_user_id self::GTMGAEEC_OP_NOT_INCLUDE_USER_ID;
  100.     /**
  101.      * @var int
  102.      *
  103.      * @ORM\Column(name="user_timings", type="smallint", nullable=false, options={"unsigned":false, "default":2})
  104.      */
  105.     private $user_timings self::GTMGAEEC_OP_WITHOUT_USER_TIMINGS;
  106.     /**
  107.      * @var int
  108.      *
  109.      * @ORM\Column(name="imp_track", type="smallint", nullable=false, options={"unsigned":false, "default":1})
  110.      */
  111.     private $imp_track self::GTMGAEEC_OP_WITH_IMP_TRACK;
  112.     /**
  113.      * @var int
  114.      *
  115.      * @ORM\Column(name="confirmation_as_purchase", type="smallint", nullable=false, options={"unsigned":false, "default":2})
  116.      */
  117.     private $confirmation_as_purchase self::GTMGAEEC_OP_NOT_CONFIRMATION_AS_PURCHASE;
  118.     /**
  119.      * @var int
  120.      *
  121.      * @ORM\Column(name="use_custom_referrer", type="smallint", nullable=false, options={"unsigned":false, "default":2})
  122.      */
  123.     private $use_custom_referrer self::GTMGAEEC_OP_NOT_USE_CUSTOM_REFERRER;
  124.     /**
  125.      * @var string
  126.      *
  127.      * @ORM\Column(name="custom_referrers", type="text", nullable=true)
  128.      */
  129.     private $custom_referrers;
  130.     /**
  131.      * @var array
  132.      */
  133.     private $custom_referrer1 = array('k' => '''v' => '');
  134.     /**
  135.      * @var array
  136.      */
  137.     private $custom_referrer2 = array('k' => '''v' => '');
  138.     /**
  139.      * @var array
  140.      */
  141.     private $custom_referrer3 = array('k' => '''v' => '');
  142.     /**
  143.      * @var array
  144.      */
  145.     private $custom_referrer4 = array('k' => '''v' => '');
  146.     /**
  147.      * @var array
  148.      */
  149.     private $custom_referrer5 = array('k' => '''v' => '');
  150.     /**
  151.      * @var array
  152.      */
  153.     private $custom_referrer6 = array('k' => '''v' => '');
  154.     /**
  155.      * @var array
  156.      */
  157.     private $custom_referrer7 = array('k' => '''v' => '');
  158.     /**
  159.      * @var array
  160.      */
  161.     private $custom_referrer8 = array('k' => '''v' => '');
  162.     /**
  163.      * @var \DateTime
  164.      *
  165.      * @ORM\Column(name="create_date", type="datetimetz")
  166.      */
  167.     private $create_date;
  168.     /**
  169.      * @var \DateTime
  170.      *
  171.      * @ORM\Column(name="update_date", type="datetimetz")
  172.      */
  173.     private $update_date;
  174.     /**
  175.      * @var array
  176.      */
  177.     private $promo;
  178.     /**
  179.      * Set id
  180.      *
  181.      * @param  integer $id
  182.      * @return Module
  183.      */
  184.     public function setId($id)
  185.     {
  186.         $this->id $id;
  187.         return $this;
  188.     }
  189.     /**
  190.      * Get id
  191.      *
  192.      * @return integer
  193.      */
  194.     public function getId()
  195.     {
  196.         return $this->id;
  197.     }
  198.     /**
  199.      * Set code
  200.      *
  201.      * @param  string $code
  202.      * @return Module
  203.      */
  204.     public function setCode($code)
  205.     {
  206.         $this->code $code;
  207.         return $this;
  208.     }
  209.     /**
  210.      * Get code
  211.      *
  212.      * @return string
  213.      */
  214.     public function getCode()
  215.     {
  216.         return $this->code;
  217.     }
  218.     /**
  219.      * Set name
  220.      *
  221.      * @param  string $name
  222.      * @return Module
  223.      */
  224.     public function setName($name)
  225.     {
  226.         $this->name $name;
  227.         return $this;
  228.     }
  229.     /**
  230.      * Get name
  231.      *
  232.      * @return string
  233.      */
  234.     public function getName()
  235.     {
  236.         return $this->name;
  237.     }
  238.     /**
  239.      * Set tid
  240.      *
  241.      * @param  string $tid
  242.      * @return Module
  243.      */
  244.     public function setTid($tid)
  245.     {
  246.         $this->tid $tid;
  247.         return $this;
  248.     }
  249.     /**
  250.      * Get tid
  251.      *
  252.      * @return string
  253.      */
  254.     public function getTid()
  255.     {
  256.         return $this->tid;
  257.     }
  258.     /**
  259.      * Set tag_version
  260.      *
  261.      * @param  integer $tag_version
  262.      * @return Module
  263.      */
  264.     public function setTagVersion($tag_version)
  265.     {
  266.         $this->tag_version $tag_version;
  267.         return $this;
  268.     }
  269.     /**
  270.      * Get tag_version
  271.      *
  272.      * @return string
  273.      */
  274.     public function getTagVersion()
  275.     {
  276.         return $this->tag_version;
  277.     }
  278.     /**
  279.      * Set eec
  280.      *
  281.      * @param  integer $eec
  282.      * @return Module
  283.      */
  284.     public function setEec($eec)
  285.     {
  286.         $this->eec $eec;
  287.         return $this;
  288.     }
  289.     /**
  290.      * Get eec
  291.      *
  292.      * @return string
  293.      */
  294.     public function getEec()
  295.     {
  296.         return $this->eec;
  297.     }
  298.     /**
  299.      * Set tag 
  300.      *
  301.      * @param  integer $tag
  302.      * @return Module
  303.      */
  304.     public function setTag($tag)
  305.     {
  306.         $this->tag $tag;
  307.         return $this;
  308.     }
  309.     /**
  310.      * Get Tag
  311.      *
  312.      * @return string
  313.      */
  314.     public function getTag()
  315.     {
  316.         return $this->tag;
  317.     }
  318.     /**
  319.      * Set category
  320.      *
  321.      * @param  string $category
  322.      * @return Module
  323.      */
  324.     public function setCategory($category)
  325.     {
  326.         $this->category $category;
  327.         return $this;
  328.     }
  329.     /**
  330.      * Get category
  331.      *
  332.      * @return string
  333.      */
  334.     public function getCategory()
  335.     {
  336.         return $this->category;
  337.     }
  338.     /**
  339.      * Set include_variant
  340.      *
  341.      * @param  integer $include_variant
  342.      * @return Module
  343.      */
  344.     public function setIncludeVariant($include_variant)
  345.     {
  346.         $this->include_variant $include_variant;
  347.         return $this;
  348.     }
  349.     /**
  350.      * Get include_variant
  351.      *
  352.      * @return integer
  353.      */
  354.     public function getIncludeVariant()
  355.     {
  356.         return $this->include_variant;
  357.     }
  358.     /**
  359.      * Set track_user_id
  360.      *
  361.      * @param  integer $track_user_id
  362.      * @return Module
  363.      */
  364.     public function setTrackUserId($track_user_id)
  365.     {
  366.         $this->track_user_id $track_user_id;
  367.         return $this;
  368.     }
  369.     /**
  370.      * Get track_user_id
  371.      *
  372.      * @return integer
  373.      */
  374.     public function getTrackUserId()
  375.     {
  376.         return $this->track_user_id;
  377.     }
  378.     /**
  379.      * Set uid
  380.      *
  381.      * @param  string $uid
  382.      * @return Module
  383.      */
  384.     public function setUID($uid)
  385.     {
  386.         $this->uid $uid;
  387.         return $this;
  388.     }
  389.     /**
  390.      * Get uid
  391.      *
  392.      * @return string
  393.      */
  394.     public function getUID()
  395.     {
  396.         return $this->uid;
  397.     }
  398.     /**
  399.      * Set user_timings
  400.      *
  401.      * @param  integer $user_timings
  402.      * @return Module
  403.      */
  404.     public function setUserTimings($user_timings)
  405.     {
  406.         $this->user_timings $user_timings;
  407.         return $this;
  408.     }
  409.     /**
  410.      * Get user_timings
  411.      *
  412.      * @return integer
  413.      */
  414.     public function getUserTimings()
  415.     {
  416.         return $this->user_timings;
  417.     }
  418.     /**
  419.      * Set imp_track
  420.      *
  421.      * @param  integer $imp_track
  422.      * @return Module
  423.      */
  424.     public function setImpTrack($imp_track)
  425.     {
  426.         $this->imp_track $imp_track;
  427.         return $this;
  428.     }
  429.     /**
  430.      * Get imp_track
  431.      *
  432.      * @return integer
  433.      */
  434.     public function getImpTrack()
  435.     {
  436.         return $this->imp_track;
  437.     }
  438.     /**
  439.      * Set confirmation_as_purchase
  440.      *
  441.      * @param  integer $confirmation_as_purchase
  442.      * @return Module
  443.      */
  444.     public function setConfirmationAsPurchase($confirmation_as_purchase)
  445.     {
  446.         $this->confirmation_as_purchase $confirmation_as_purchase;
  447.         return $this;
  448.     }
  449.     /**
  450.      * Get confirmation_as_purchase
  451.      *
  452.      * @return integer
  453.      */
  454.     public function getConfirmationAsPurchase()
  455.     {
  456.         return $this->confirmation_as_purchase;
  457.     }
  458.     /**
  459.      * Set use_custom_referrer
  460.      *
  461.      * @param  integer $use_custom_referrer
  462.      * @return Module
  463.      */
  464.     public function setUseCustomReferrer($use_custom_referrer)
  465.     {
  466.         $this->use_custom_referrer $use_custom_referrer;
  467.         return $this;
  468.     }
  469.     /**
  470.      * Get use_custom_referrer
  471.      *
  472.      * @return integer
  473.      */
  474.     public function getUseCustomReferrer()
  475.     {
  476.         return $this->use_custom_referrer;
  477.     }
  478.     /**
  479.      * Set custom_referrers
  480.      *
  481.      * @param  string $custom_referrers
  482.      * @return Module
  483.      */
  484.     public function setCustomReferrers($custom_referrer_keys$custom_referrer_values)
  485.     {
  486.         $custom_referrers array_map(null$custom_referrer_keys$custom_referrer_values); // zip($custom_referrer_keys, $custom_referrer_values)
  487.         $this->custom_referrers json_encode($custom_referrers);
  488.         return $this;
  489.     }
  490.     /**
  491.      * Get custom_referrers
  492.      *
  493.      * @return string
  494.      */
  495.     public function getCustomReferrers()
  496.     {
  497.         $custom_referrers json_decode($this->custom_referrerstrue);
  498.         for ($i 0$i 8$i++) {
  499.             if (!empty($custom_referrers[$i])) {
  500.                 $setCustomReferrer 'setCustomReferrer' . ($i 1);
  501.                 $this->$setCustomReferrer($custom_referrers[$i]);
  502.             }
  503.         }
  504.         return $custom_referrers;
  505.     }
  506.     /**
  507.      * Set custom_referrer1
  508.      *
  509.      * @param  array $custom_referrer
  510.      * @return Module
  511.      */
  512.     public function setCustomReferrer1($custom_referrer)
  513.     {
  514.         $this->custom_referrer1['k'] = $custom_referrer[0];
  515.         $this->custom_referrer1['v'] = $custom_referrer[1];
  516.         return $this;
  517.     }
  518.     /**
  519.      * Get custom_referrer1
  520.      *
  521.      * @return array
  522.      */
  523.     public function getCustomReferrer1()
  524.     {
  525.         return $this->custom_referrer1;
  526.     }
  527.     /**
  528.      * Set custom_referrer2
  529.      *
  530.      * @param  array $custom_referrer
  531.      * @return Module
  532.      */
  533.     public function setCustomReferrer2($custom_referrer)
  534.     {
  535.         $this->custom_referrer2['k'] = $custom_referrer[0];
  536.         $this->custom_referrer2['v'] = $custom_referrer[1];
  537.         return $this;
  538.     }
  539.     /**
  540.      * Get custom_referrer2
  541.      *
  542.      * @return array
  543.      */
  544.     public function getCustomReferrer2()
  545.     {
  546.         return $this->custom_referrer2;
  547.     }
  548.     /**
  549.      * Set custom_referrer3
  550.      *
  551.      * @param  array $custom_referrer
  552.      * @return Module
  553.      */
  554.     public function setCustomReferrer3($custom_referrer)
  555.     {
  556.         $this->custom_referrer3['k'] = $custom_referrer[0];
  557.         $this->custom_referrer3['v'] = $custom_referrer[1];
  558.         return $this;
  559.     }
  560.     /**
  561.      * Get custom_referrer3
  562.      *
  563.      * @return array
  564.      */
  565.     public function getCustomReferrer3()
  566.     {
  567.         return $this->custom_referrer3;
  568.     }
  569.     /**
  570.      * Set custom_referrer4
  571.      *
  572.      * @param  array $custom_referrer
  573.      * @return Module
  574.      */
  575.     public function setCustomReferrer4($custom_referrer)
  576.     {
  577.         $this->custom_referrer4['k'] = $custom_referrer[0];
  578.         $this->custom_referrer4['v'] = $custom_referrer[1];
  579.         return $this;
  580.     }
  581.     /**
  582.      * Get custom_referrer4
  583.      *
  584.      * @return array
  585.      */
  586.     public function getCustomReferrer4()
  587.     {
  588.         return $this->custom_referrer4;
  589.     }
  590.     /**
  591.      * Set custom_referrer5
  592.      *
  593.      * @param  array $custom_referrer
  594.      * @return Module
  595.      */
  596.     public function setCustomReferrer5($custom_referrer)
  597.     {
  598.         $this->custom_referrer5['k'] = $custom_referrer[0];
  599.         $this->custom_referrer5['v'] = $custom_referrer[1];
  600.         return $this;
  601.     }
  602.     /**
  603.      * Get custom_referrer5
  604.      *
  605.      * @return array
  606.      */
  607.     public function getCustomReferrer5()
  608.     {
  609.         return $this->custom_referrer5;
  610.     }
  611.     /**
  612.      * Set custom_referrer6
  613.      *
  614.      * @param  array $custom_referrer
  615.      * @return Module
  616.      */
  617.     public function setCustomReferrer6($custom_referrer)
  618.     {
  619.         $this->custom_referrer6['k'] = $custom_referrer[0];
  620.         $this->custom_referrer6['v'] = $custom_referrer[1];
  621.         return $this;
  622.     }
  623.     /**
  624.      * Get custom_referrer6
  625.      *
  626.      * @return array
  627.      */
  628.     public function getCustomReferrer6()
  629.     {
  630.         return $this->custom_referrer6;
  631.     }
  632.     /**
  633.      * Set custom_referrer7
  634.      *
  635.      * @param  array $custom_referrer
  636.      * @return Module
  637.      */
  638.     public function setCustomReferrer7($custom_referrer)
  639.     {
  640.         $this->custom_referrer7['k'] = $custom_referrer[0];
  641.         $this->custom_referrer7['v'] = $custom_referrer[1];
  642.         return $this;
  643.     }
  644.     /**
  645.      * Get custom_referrer7
  646.      *
  647.      * @return array
  648.      */
  649.     public function getCustomReferrer7()
  650.     {
  651.         return $this->custom_referrer7;
  652.     }
  653.     /**
  654.      * Set custom_referrer8
  655.      *
  656.      * @param  array $custom_referrer
  657.      * @return Module
  658.      */
  659.     public function setCustomReferrer8($custom_referrer)
  660.     {
  661.         $this->custom_referrer8['k'] = $custom_referrer[0];
  662.         $this->custom_referrer8['v'] = $custom_referrer[1];
  663.         return $this;
  664.     }
  665.     /**
  666.      * Get custom_referrer8
  667.      *
  668.      * @return array
  669.      */
  670.     public function getCustomReferrer8()
  671.     {
  672.         return $this->custom_referrer8;
  673.     }
  674.     /**
  675.      * Set create_date
  676.      *
  677.      * @param  \DateTime $createDate
  678.      * @return Module
  679.      */
  680.     public function setCreateDate($createDate)
  681.     {
  682.         $this->create_date $createDate;
  683.         return $this;
  684.     }
  685.     /**
  686.      * Get create_date
  687.      *
  688.      * @return \DateTime
  689.      */
  690.     public function getCreateDate()
  691.     {
  692.         return $this->create_date;
  693.     }
  694.     /**
  695.      * Set update_date
  696.      *
  697.      * @param  \DateTime $updateDate
  698.      * @return Module
  699.      */
  700.     public function setUpdateDate($updateDate)
  701.     {
  702.         $this->update_date $updateDate;
  703.         return $this;
  704.     }
  705.     /**
  706.      * Get update_date
  707.      *
  708.      * @return \DateTime
  709.      */
  710.     public function getUpdateDate()
  711.     {
  712.         return $this->update_date;
  713.     }
  714.     /**
  715.      * Set promo
  716.      *
  717.      * @param  string $id
  718.      * @param  string $name
  719.      * @param  string $creative
  720.      * @param  string $position
  721.      * @return Module
  722.      */
  723.     public function setPromo($id$name$creative$position)
  724.     {
  725.         $this->promo = array(
  726.             'id' => $id,
  727.             'name' => $name,
  728.             'creative' => $creative,
  729.             'position' => $position
  730.         );
  731.         return $this;
  732.     }
  733.     /**
  734.      * Get promo
  735.      *
  736.      * @return array
  737.      */
  738.     public function getPromo()
  739.     {
  740.         return $this->promo;
  741.     }
  742. }