src/Entity/Gos/TouchPointAll.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\HttpFoundation\Request;
  5. /**
  6.  * @ORM\Entity(repositoryClass="App\Repository\TouchPointAllRepository")
  7.  * ORM\Table(name="touch_point_all", indexes={@ORM\Index(name="IDX_cookies_all_hash", columns={"cookies_hash"})})
  8.  * @ORM\HasLifecycleCallbacks
  9.  */
  10. class TouchPointAll
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=8, nullable=true)
  20.      */
  21.     private $actionNumber;
  22.     /**
  23.      * @ORM\Column(type="string", length=100, nullable=true)
  24.      */
  25.     private $fromSource;
  26.     /**
  27.      * @ORM\Column(type="string", length=100, nullable=true)
  28.      */
  29.     private $campaign;
  30.     /**
  31.      * @ORM\Column(type="string", length=100, nullable=true)
  32.      */
  33.     private $campaignChannel;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $cookiesHash;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $visitorID;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      */
  45.     private $visitID;
  46.     /**
  47.      * @ORM\Column(type="string", length=255, nullable=true)
  48.      */
  49.     private $gosVisitID;
  50.     /**
  51.      * @ORM\Column(type="string", length=255, nullable=true)
  52.      */
  53.     private $customerID;
  54.     /**
  55.      * @ORM\Column(type="string", length=255, nullable=true)
  56.      */
  57.     private $touchPointType;
  58.     /**
  59.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\User", inversedBy="touchPointAll")
  60.      * @ORM\JoinColumn()
  61.      */
  62.     private $user;
  63.     /**
  64.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\PortalSettings", inversedBy="touchPointAll")
  65.      * @ORM\JoinColumn()
  66.      */
  67.     private $portalSettings;
  68.     /**
  69.      * @ORM\OneToOne(targetEntity="App\Entity\Gos\Orders", inversedBy="touchPointAll")
  70.      * @ORM\JoinColumn()
  71.      */
  72.     private $order;
  73.     /**
  74.      * @ORM\Column(type="datetime")
  75.      */
  76.     private $createdAt;
  77.     /**
  78.      * @ORM\Column(type="datetime", nullable=true)
  79.      */
  80.     private $updatedAt;
  81.     /**
  82.      * @ORM\Column(type="text", nullable=true)
  83.      */
  84.     private $url;
  85.     /**
  86.      * @ORM\Column(type="text", nullable=true)
  87.      */
  88.     private $userAgent;
  89.     /**
  90.      * @ORM\Column(type="text", nullable=true)
  91.      */
  92.     private $dataLayerUrl;
  93.     public function getObjectVars()
  94.     {
  95.         return get_object_vars($this);
  96.     }
  97.     public function generatedCookiesHash()
  98.     {
  99.         $this->cookiesHash bin2hex(random_bytes(15));
  100.         return $this;
  101.     }
  102.     public function generatedCustomerID(User $user)
  103.     {
  104.         $this->customerID md5($user->getEmail());
  105.         return $this;
  106.     }
  107.     public function generatedGosVisitID()
  108.     {
  109.         $this->gosVisitID bin2hex(random_bytes(15));
  110.         return $this;
  111.     }
  112.     public function setActionNumberFromPortalSettings()
  113.     {
  114.         if (!empty($this->getPortalSettings()))
  115.         {
  116.             $this->setActionNumber($this->getPortalSettings()->getActionNumber());
  117.         }
  118.         return $this;
  119.     }
  120.     public function setDataFromRequest(Request $request)
  121.     {
  122.         if (!empty($request->query->get('a')))
  123.         {
  124.             $this->setActionNumber($request->query->get('a'));
  125.         }
  126.         else
  127.         {
  128.             $this->setActionNumber($request->request->get('a'));
  129.         }
  130.         $this->setFromSource($request->query->get('f'));
  131.         $this->setCampaign($request->query->get('c'));
  132.         $this->setCampaignChannel($request->query->get('chc'));
  133.         $this->setVisitID($request->query->get('visitId'));
  134.         $this->setVisitorID($request->query->get('visitorId'));
  135.         $this->setDataLayerUrl($request->query->get('dataLayerUrl'));
  136.         $this->setUserAgent($request->server->get('HTTP_USER_AGENT'));
  137.     }
  138.     /** @ORM\PrePersist() */
  139.     public function prePersist()
  140.     {
  141.         $this->createdAt = new \DateTime();
  142.     }
  143.     /** @ORM\PreUpdate() */
  144.     public function preUpdate()
  145.     {
  146.         $this->updatedAt = new \DateTime();
  147.     }
  148.     public function __toString()
  149.     {
  150.         return (string)$this->cookiesHash;
  151.     }
  152.     //------------------------------ setters & getters
  153.     public function getId(): ?int
  154.     {
  155.         return $this->id;
  156.     }
  157.     public function getActionNumber(): ?string
  158.     {
  159.         return $this->actionNumber;
  160.     }
  161.     public function setActionNumber(?string $actionNumber): self
  162.     {
  163.         $this->actionNumber $actionNumber;
  164.         return $this;
  165.     }
  166.     public function getFromSource(): ?string
  167.     {
  168.         return $this->fromSource;
  169.     }
  170.     public function setFromSource(?string $fromSource): self
  171.     {
  172.         $this->fromSource $fromSource;
  173.         return $this;
  174.     }
  175.     public function getCampaign(): ?string
  176.     {
  177.         return $this->campaign;
  178.     }
  179.     public function setCampaign(?string $campaign): self
  180.     {
  181.         $this->campaign $campaign;
  182.         return $this;
  183.     }
  184.     public function getCampaignChannel(): ?string
  185.     {
  186.         return $this->campaignChannel;
  187.     }
  188.     public function setCampaignChannel(?string $campaignChannel): self
  189.     {
  190.         $this->campaignChannel $campaignChannel;
  191.         return $this;
  192.     }
  193.     public function getCookiesHash(): ?string
  194.     {
  195.         return $this->cookiesHash;
  196.     }
  197.     public function setCookiesHash(?string $cookiesHash): self
  198.     {
  199.         $this->cookiesHash $cookiesHash;
  200.         return $this;
  201.     }
  202.     public function getVisitorID(): ?string
  203.     {
  204.         return $this->visitorID;
  205.     }
  206.     public function setVisitorID(?string $visitorID): self
  207.     {
  208.         $this->visitorID $visitorID;
  209.         return $this;
  210.     }
  211.     public function getVisitID(): ?string
  212.     {
  213.         return $this->visitID;
  214.     }
  215.     public function setVisitID(?string $visitID): self
  216.     {
  217.         $this->visitID $visitID;
  218.         return $this;
  219.     }
  220.     public function getGosVisitID(): ?string
  221.     {
  222.         return $this->gosVisitID;
  223.     }
  224.     public function setGosVisitID(?string $gosVisitID): self
  225.     {
  226.         $this->gosVisitID $gosVisitID;
  227.         return $this;
  228.     }
  229.     public function getCustomerID(): ?string
  230.     {
  231.         return $this->customerID;
  232.     }
  233.     public function setCustomerID(?string $customerID): self
  234.     {
  235.         $this->customerID $customerID;
  236.         return $this;
  237.     }
  238.     public function getCreatedAt(): ?\DateTimeInterface
  239.     {
  240.         return $this->createdAt;
  241.     }
  242.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  243.     {
  244.         $this->createdAt $createdAt;
  245.         return $this;
  246.     }
  247.     public function getUpdatedAt(): ?\DateTimeInterface
  248.     {
  249.         return $this->updatedAt;
  250.     }
  251.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  252.     {
  253.         $this->updatedAt $updatedAt;
  254.         return $this;
  255.     }
  256.     public function getUser(): ?User
  257.     {
  258.         return $this->user;
  259.     }
  260.     public function setUser(?User $user): self
  261.     {
  262.         $this->user $user;
  263.         return $this;
  264.     }
  265.     public function getPortalSettings(): ?PortalSettings
  266.     {
  267.         return $this->portalSettings;
  268.     }
  269.     public function setPortalSettings(?PortalSettings $portalSettings): self
  270.     {
  271.         $this->portalSettings $portalSettings;
  272.         return $this;
  273.     }
  274.     public function getTouchPointType(): ?string
  275.     {
  276.         return $this->touchPointType;
  277.     }
  278.     public function setTouchPointType(?string $touchPointType): self
  279.     {
  280.         $this->touchPointType $touchPointType;
  281.         return $this;
  282.     }
  283.     public function getOrder(): ?Orders
  284.     {
  285.         return $this->order;
  286.     }
  287.     public function setOrder(?Orders $order): self
  288.     {
  289.         $this->order $order;
  290.         return $this;
  291.     }
  292.     public function getUrl(): ?string
  293.     {
  294.         return $this->url;
  295.     }
  296.     public function setUrl(?string $url): self
  297.     {
  298.         $this->url $url;
  299.         return $this;
  300.     }
  301.     public function getDataLayerUrl(): ?string
  302.     {
  303.         return $this->dataLayerUrl;
  304.     }
  305.     public function setDataLayerUrl(?string $dataLayerUrl): self
  306.     {
  307.         $this->dataLayerUrl $dataLayerUrl;
  308.         return $this;
  309.     }
  310.     public function getUserAgent(): ?string
  311.     {
  312.         return $this->userAgent;
  313.     }
  314.     public function setUserAgent(?string $userAgent): self
  315.     {
  316.         $this->userAgent $userAgent;
  317.         return $this;
  318.     }
  319. }