<?php
/*
* GtmGaEEc42: GTM版 Google Analytics eコマース/拡張eコマース対応プラグイン
* Copyright (C) 2017-2022 Freischtide Inc. All Rights Reserved.
* http://freischtide.tumblr.com/
*
* License: see LICENSE.txt
*/
namespace Plugin\GtmGaEEc42\Entity;
use Doctrine\ORM\Mapping as ORM;
use Eccube\Entity\AbstractEntity;
/**
* GtmGaEEc
*
* @ORM\Table(name="plg_gtmgaeec_plugin")
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
* @ORM\HasLifecycleCallbacks()
* @ORM\Entity(repositoryClass="Plugin\GtmGaEEc42\Repository\GtmGaEEcRepository")
*/
class GtmGaEEc extends AbstractEntity
{
const GTMGAEEC_TAG_UA = 1;
const GTMGAEEC_TAG_GA4 = 2;
const GTMGAEEC_USE_EEC = 1;
const GTMGAEEC_USE_EC = 2;
const GTMGAEEC_USE_GTM_TAG = 1;
const GTMGAEEC_USE_NO_GTM_TAG = 2;
const GTMGAEEC_OP_CATEGORY_ON = 1;
const GTMGAEEC_OP_CATEGORY_OFF = 2;
const GTMGAEEC_OP_WITH_VARIANT = 1;
const GTMGAEEC_OP_WITHOUT_VARIANT = 2;
const GTMGAEEC_OP_INCLUDE_USER_ID = 1;
const GTMGAEEC_OP_NOT_INCLUDE_USER_ID = 2;
const GTMGAEEC_OP_WITH_USER_TIMINGS = 1;
const GTMGAEEC_OP_WITHOUT_USER_TIMINGS = 2;
const GTMGAEEC_OP_WITH_IMP_TRACK = 1;
const GTMGAEEC_OP_WITHOUT_IMP_TRACK = 2;
const GTMGAEEC_OP_CONFIRMATION_AS_PURCHASE = 1;
const GTMGAEEC_OP_NOT_CONFIRMATION_AS_PURCHASE = 2;
const GTMGAEEC_OP_USE_CUSTOM_REFERRER = 1;
const GTMGAEEC_OP_NOT_USE_CUSTOM_REFERRER = 2;
/**
* @ORM\PostLoad
*/
public function init()
{
$this->getCustomReferrers();
}
/**
* @var int
*
* @ORM\Column(name="id", type="integer", options={"unsigned":true})
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="tid", type="string", nullable=true, length=255)
*/
private $tid;
/**
* @var int
*
* @ORM\Column(name="tag_version", type="smallint", nullable=false, options={"unsigned":false, "default":1})
*/
private $tag_version = self::GTMGAEEC_TAG_UA;
/**
* @var int
*
* @ORM\Column(name="eec", type="smallint", nullable=false, options={"unsigned":false, "default":1})
*/
private $eec = self::GTMGAEEC_USE_EEC;
/**
* @var int
*
* @ORM\Column(name="tag", type="smallint", nullable=false, options={"unsigned":false, "default":1})
*/
private $tag = self::GTMGAEEC_USE_GTM_TAG;
/**
* @var int
*
* @ORM\Column(name="category", type="smallint", nullable=false, options={"unsigned":false, "default":1})
*/
private $category = self::GTMGAEEC_OP_CATEGORY_ON;
/**
* @var int
*
* @ORM\Column(name="include_variant", type="smallint", nullable=false, options={"unsigned":false, "default":2})
*/
private $include_variant = self::GTMGAEEC_OP_WITHOUT_VARIANT;
/**
* @var int
*
* @ORM\Column(name="track_user_id", type="smallint", nullable=false, options={"unsigned":false, "default":2})
*/
private $track_user_id = self::GTMGAEEC_OP_NOT_INCLUDE_USER_ID;
/**
* @var int
*
* @ORM\Column(name="user_timings", type="smallint", nullable=false, options={"unsigned":false, "default":2})
*/
private $user_timings = self::GTMGAEEC_OP_WITHOUT_USER_TIMINGS;
/**
* @var int
*
* @ORM\Column(name="imp_track", type="smallint", nullable=false, options={"unsigned":false, "default":1})
*/
private $imp_track = self::GTMGAEEC_OP_WITH_IMP_TRACK;
/**
* @var int
*
* @ORM\Column(name="confirmation_as_purchase", type="smallint", nullable=false, options={"unsigned":false, "default":2})
*/
private $confirmation_as_purchase = self::GTMGAEEC_OP_NOT_CONFIRMATION_AS_PURCHASE;
/**
* @var int
*
* @ORM\Column(name="use_custom_referrer", type="smallint", nullable=false, options={"unsigned":false, "default":2})
*/
private $use_custom_referrer = self::GTMGAEEC_OP_NOT_USE_CUSTOM_REFERRER;
/**
* @var string
*
* @ORM\Column(name="custom_referrers", type="text", nullable=true)
*/
private $custom_referrers;
/**
* @var array
*/
private $custom_referrer1 = array('k' => '', 'v' => '');
/**
* @var array
*/
private $custom_referrer2 = array('k' => '', 'v' => '');
/**
* @var array
*/
private $custom_referrer3 = array('k' => '', 'v' => '');
/**
* @var array
*/
private $custom_referrer4 = array('k' => '', 'v' => '');
/**
* @var array
*/
private $custom_referrer5 = array('k' => '', 'v' => '');
/**
* @var array
*/
private $custom_referrer6 = array('k' => '', 'v' => '');
/**
* @var array
*/
private $custom_referrer7 = array('k' => '', 'v' => '');
/**
* @var array
*/
private $custom_referrer8 = array('k' => '', 'v' => '');
/**
* @var \DateTime
*
* @ORM\Column(name="create_date", type="datetimetz")
*/
private $create_date;
/**
* @var \DateTime
*
* @ORM\Column(name="update_date", type="datetimetz")
*/
private $update_date;
/**
* @var array
*/
private $promo;
/**
* Set id
*
* @param integer $id
* @return Module
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set code
*
* @param string $code
* @return Module
*/
public function setCode($code)
{
$this->code = $code;
return $this;
}
/**
* Get code
*
* @return string
*/
public function getCode()
{
return $this->code;
}
/**
* Set name
*
* @param string $name
* @return Module
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set tid
*
* @param string $tid
* @return Module
*/
public function setTid($tid)
{
$this->tid = $tid;
return $this;
}
/**
* Get tid
*
* @return string
*/
public function getTid()
{
return $this->tid;
}
/**
* Set tag_version
*
* @param integer $tag_version
* @return Module
*/
public function setTagVersion($tag_version)
{
$this->tag_version = $tag_version;
return $this;
}
/**
* Get tag_version
*
* @return string
*/
public function getTagVersion()
{
return $this->tag_version;
}
/**
* Set eec
*
* @param integer $eec
* @return Module
*/
public function setEec($eec)
{
$this->eec = $eec;
return $this;
}
/**
* Get eec
*
* @return string
*/
public function getEec()
{
return $this->eec;
}
/**
* Set tag
*
* @param integer $tag
* @return Module
*/
public function setTag($tag)
{
$this->tag = $tag;
return $this;
}
/**
* Get Tag
*
* @return string
*/
public function getTag()
{
return $this->tag;
}
/**
* Set category
*
* @param string $category
* @return Module
*/
public function setCategory($category)
{
$this->category = $category;
return $this;
}
/**
* Get category
*
* @return string
*/
public function getCategory()
{
return $this->category;
}
/**
* Set include_variant
*
* @param integer $include_variant
* @return Module
*/
public function setIncludeVariant($include_variant)
{
$this->include_variant = $include_variant;
return $this;
}
/**
* Get include_variant
*
* @return integer
*/
public function getIncludeVariant()
{
return $this->include_variant;
}
/**
* Set track_user_id
*
* @param integer $track_user_id
* @return Module
*/
public function setTrackUserId($track_user_id)
{
$this->track_user_id = $track_user_id;
return $this;
}
/**
* Get track_user_id
*
* @return integer
*/
public function getTrackUserId()
{
return $this->track_user_id;
}
/**
* Set uid
*
* @param string $uid
* @return Module
*/
public function setUID($uid)
{
$this->uid = $uid;
return $this;
}
/**
* Get uid
*
* @return string
*/
public function getUID()
{
return $this->uid;
}
/**
* Set user_timings
*
* @param integer $user_timings
* @return Module
*/
public function setUserTimings($user_timings)
{
$this->user_timings = $user_timings;
return $this;
}
/**
* Get user_timings
*
* @return integer
*/
public function getUserTimings()
{
return $this->user_timings;
}
/**
* Set imp_track
*
* @param integer $imp_track
* @return Module
*/
public function setImpTrack($imp_track)
{
$this->imp_track = $imp_track;
return $this;
}
/**
* Get imp_track
*
* @return integer
*/
public function getImpTrack()
{
return $this->imp_track;
}
/**
* Set confirmation_as_purchase
*
* @param integer $confirmation_as_purchase
* @return Module
*/
public function setConfirmationAsPurchase($confirmation_as_purchase)
{
$this->confirmation_as_purchase = $confirmation_as_purchase;
return $this;
}
/**
* Get confirmation_as_purchase
*
* @return integer
*/
public function getConfirmationAsPurchase()
{
return $this->confirmation_as_purchase;
}
/**
* Set use_custom_referrer
*
* @param integer $use_custom_referrer
* @return Module
*/
public function setUseCustomReferrer($use_custom_referrer)
{
$this->use_custom_referrer = $use_custom_referrer;
return $this;
}
/**
* Get use_custom_referrer
*
* @return integer
*/
public function getUseCustomReferrer()
{
return $this->use_custom_referrer;
}
/**
* Set custom_referrers
*
* @param string $custom_referrers
* @return Module
*/
public function setCustomReferrers($custom_referrer_keys, $custom_referrer_values)
{
$custom_referrers = array_map(null, $custom_referrer_keys, $custom_referrer_values); // zip($custom_referrer_keys, $custom_referrer_values)
$this->custom_referrers = json_encode($custom_referrers);
return $this;
}
/**
* Get custom_referrers
*
* @return string
*/
public function getCustomReferrers()
{
$custom_referrers = json_decode($this->custom_referrers, true);
for ($i = 0; $i < 8; $i++) {
if (!empty($custom_referrers[$i])) {
$setCustomReferrer = 'setCustomReferrer' . ($i + 1);
$this->$setCustomReferrer($custom_referrers[$i]);
}
}
return $custom_referrers;
}
/**
* Set custom_referrer1
*
* @param array $custom_referrer
* @return Module
*/
public function setCustomReferrer1($custom_referrer)
{
$this->custom_referrer1['k'] = $custom_referrer[0];
$this->custom_referrer1['v'] = $custom_referrer[1];
return $this;
}
/**
* Get custom_referrer1
*
* @return array
*/
public function getCustomReferrer1()
{
return $this->custom_referrer1;
}
/**
* Set custom_referrer2
*
* @param array $custom_referrer
* @return Module
*/
public function setCustomReferrer2($custom_referrer)
{
$this->custom_referrer2['k'] = $custom_referrer[0];
$this->custom_referrer2['v'] = $custom_referrer[1];
return $this;
}
/**
* Get custom_referrer2
*
* @return array
*/
public function getCustomReferrer2()
{
return $this->custom_referrer2;
}
/**
* Set custom_referrer3
*
* @param array $custom_referrer
* @return Module
*/
public function setCustomReferrer3($custom_referrer)
{
$this->custom_referrer3['k'] = $custom_referrer[0];
$this->custom_referrer3['v'] = $custom_referrer[1];
return $this;
}
/**
* Get custom_referrer3
*
* @return array
*/
public function getCustomReferrer3()
{
return $this->custom_referrer3;
}
/**
* Set custom_referrer4
*
* @param array $custom_referrer
* @return Module
*/
public function setCustomReferrer4($custom_referrer)
{
$this->custom_referrer4['k'] = $custom_referrer[0];
$this->custom_referrer4['v'] = $custom_referrer[1];
return $this;
}
/**
* Get custom_referrer4
*
* @return array
*/
public function getCustomReferrer4()
{
return $this->custom_referrer4;
}
/**
* Set custom_referrer5
*
* @param array $custom_referrer
* @return Module
*/
public function setCustomReferrer5($custom_referrer)
{
$this->custom_referrer5['k'] = $custom_referrer[0];
$this->custom_referrer5['v'] = $custom_referrer[1];
return $this;
}
/**
* Get custom_referrer5
*
* @return array
*/
public function getCustomReferrer5()
{
return $this->custom_referrer5;
}
/**
* Set custom_referrer6
*
* @param array $custom_referrer
* @return Module
*/
public function setCustomReferrer6($custom_referrer)
{
$this->custom_referrer6['k'] = $custom_referrer[0];
$this->custom_referrer6['v'] = $custom_referrer[1];
return $this;
}
/**
* Get custom_referrer6
*
* @return array
*/
public function getCustomReferrer6()
{
return $this->custom_referrer6;
}
/**
* Set custom_referrer7
*
* @param array $custom_referrer
* @return Module
*/
public function setCustomReferrer7($custom_referrer)
{
$this->custom_referrer7['k'] = $custom_referrer[0];
$this->custom_referrer7['v'] = $custom_referrer[1];
return $this;
}
/**
* Get custom_referrer7
*
* @return array
*/
public function getCustomReferrer7()
{
return $this->custom_referrer7;
}
/**
* Set custom_referrer8
*
* @param array $custom_referrer
* @return Module
*/
public function setCustomReferrer8($custom_referrer)
{
$this->custom_referrer8['k'] = $custom_referrer[0];
$this->custom_referrer8['v'] = $custom_referrer[1];
return $this;
}
/**
* Get custom_referrer8
*
* @return array
*/
public function getCustomReferrer8()
{
return $this->custom_referrer8;
}
/**
* Set create_date
*
* @param \DateTime $createDate
* @return Module
*/
public function setCreateDate($createDate)
{
$this->create_date = $createDate;
return $this;
}
/**
* Get create_date
*
* @return \DateTime
*/
public function getCreateDate()
{
return $this->create_date;
}
/**
* Set update_date
*
* @param \DateTime $updateDate
* @return Module
*/
public function setUpdateDate($updateDate)
{
$this->update_date = $updateDate;
return $this;
}
/**
* Get update_date
*
* @return \DateTime
*/
public function getUpdateDate()
{
return $this->update_date;
}
/**
* Set promo
*
* @param string $id
* @param string $name
* @param string $creative
* @param string $position
* @return Module
*/
public function setPromo($id, $name, $creative, $position)
{
$this->promo = array(
'id' => $id,
'name' => $name,
'creative' => $creative,
'position' => $position
);
return $this;
}
/**
* Get promo
*
* @return array
*/
public function getPromo()
{
return $this->promo;
}
}