app/Plugin/TwoFactorAuthCustomer42/Entity/TwoFactorAuthCustomerCookie.php line 32

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\TwoFactorAuthCustomer42\Entity;
  13. use DateTime;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use Eccube\Entity\AbstractEntity;
  16. use Eccube\Entity\Customer;
  17. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  18. /**
  19.  * TwoFactorCustomerCookie
  20.  *
  21.  * @ORM\Table(name="plg_two_factor_customer_cookie")
  22.  * @ORM\InheritanceType("SINGLE_TABLE")
  23.  * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  24.  * @ORM\HasLifecycleCallbacks()
  25.  * @ORM\Entity(repositoryClass="Plugin\TwoFactorAuthCustomer42\Repository\TwoFactorAuthConfigRepository")
  26.  * @UniqueEntity("id")
  27.  */
  28. class TwoFactorAuthCustomerCookie extends AbstractEntity
  29. {
  30.     /**
  31.      * @var int
  32.      *
  33.      * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  34.      * @ORM\Id
  35.      * @ORM\GeneratedValue(strategy="IDENTITY")
  36.      */
  37.     private int $id;
  38.     /**
  39.      * @var Customer
  40.      *
  41.      * @ORM\ManyToOne(targetEntity="Eccube\Entity\Customer", inversedBy="TwoFactorCustomerCookie")
  42.      * @ORM\JoinColumns({
  43.      *   @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
  44.      * })
  45.      */
  46.     private Customer $Customer;
  47.     /**
  48.      * @var string
  49.      *
  50.      * @ORM\Column(name="cookie_name", type="string", nullable=false, length=512)
  51.      */
  52.     private string $cookie_name;
  53.     /**
  54.      * @var string
  55.      *
  56.      * @ORM\Column(name="cookie_value", type="string", nullable=false, length=512, unique=true)
  57.      */
  58.     private string $cookie_value;
  59.     /**
  60.      * @var \DateTime
  61.      *
  62.      * @ORM\Column(name="cookie_expire_date", type="datetime", nullable=true)
  63.      */
  64.     private ?\DateTime $cookie_expire_date;
  65.     /**
  66.      * @var \DateTime
  67.      *
  68.      * @ORM\Column(name="created_at", type="datetime", nullable=false)
  69.      */
  70.     private \DateTime $createdAt;
  71.     /**
  72.      * @var \DateTime
  73.      *
  74.      * @ORM\Column(name="updated_at", type="datetime", nullable=false)
  75.      */
  76.     private \DateTime $updatedAt;
  77.     /**
  78.      * @ORM\PrePersist
  79.      * @ORM\PreUpdate
  80.      */
  81.     public function updatedTimestamps(): void
  82.     {
  83.         $this->setUpdatedAt(new \DateTime('now'));
  84.         if (!isset($this->createdAt) || $this->getCreatedAt() === null) {
  85.             $this->setCreatedAt(new \DateTime('now'));
  86.         }
  87.     }
  88.     /**
  89.      * @return \DateTime
  90.      */
  91.     public function getCreatedAt(): \DateTime
  92.     {
  93.         return $this->createdAt;
  94.     }
  95.     /**
  96.      * @param \DateTime $createdAt
  97.      */
  98.     public function setCreatedAt(\DateTime $createdAt): void
  99.     {
  100.         $this->createdAt $createdAt;
  101.     }
  102.     /**
  103.      * @return int
  104.      */
  105.     public function getId(): int
  106.     {
  107.         return $this->id;
  108.     }
  109.     /**
  110.      * @return Customer
  111.      */
  112.     public function getCustomer(): Customer
  113.     {
  114.         return $this->Customer;
  115.     }
  116.     /**
  117.      * @param Customer $Customer
  118.      */
  119.     public function setCustomer(Customer $Customer): void
  120.     {
  121.         $this->Customer $Customer;
  122.     }
  123.     /**
  124.      * @return string
  125.      */
  126.     public function getCookieName(): string
  127.     {
  128.         return $this->cookie_name;
  129.     }
  130.     /**
  131.      * @param string $cookie_name
  132.      */
  133.     public function setCookieName(string $cookie_name): void
  134.     {
  135.         $this->cookie_name $cookie_name;
  136.     }
  137.     /**
  138.      * @return string
  139.      */
  140.     public function getCookieValue(): string
  141.     {
  142.         return $this->cookie_value;
  143.     }
  144.     /**
  145.      * @param string $cookie_value
  146.      */
  147.     public function setCookieValue(string $cookie_value): void
  148.     {
  149.         $this->cookie_value $cookie_value;
  150.     }
  151.     /**
  152.      * @return \DateTime
  153.      */
  154.     public function getCookieExpireDate(): \DateTime
  155.     {
  156.         return $this->cookie_expire_date;
  157.     }
  158.     /**
  159.      * @param \DateTime $cookie_expire_date
  160.      */
  161.     public function setCookieExpireDate(\DateTime $cookie_expire_date): void
  162.     {
  163.         $this->cookie_expire_date $cookie_expire_date;
  164.     }
  165.     /**
  166.      * @return \DateTime
  167.      */
  168.     public function getUpdatedAt(): \DateTime
  169.     {
  170.         return $this->updatedAt;
  171.     }
  172.     /**
  173.      * @param \DateTime $updatedAt
  174.      */
  175.     public function setUpdatedAt(\DateTime $updatedAt): void
  176.     {
  177.         $this->updatedAt $updatedAt;
  178.     }
  179. }