src/Entity/ApiClient.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\ApiBundle\Entity\Cart;
  4. use DateTime;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Security\Core\User\UserInterface;
  7. /**
  8.  * @ORM\Entity
  9.  * @ORM\Table(name="malys_api_client")
  10.  * @ORM\HasLifecycleCallbacks()
  11.  */
  12. class ApiClient implements UserInterface
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue(strategy="AUTO")
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", unique=true)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @ORM\Column(type="string", unique=true)
  26.      */
  27.     private $username;
  28.     /**
  29.      * @ORM\Column(type="string", unique=true)
  30.      */
  31.     private $apiKey;
  32.     /**
  33.      * @var boolean
  34.      *
  35.      * @ORM\Column(name="enabled", type="boolean" )
  36.      */
  37.     protected $enabled true;
  38.     public function getUsername(): string
  39.     {
  40.         return $this->username;
  41.     }
  42.     public function getRoles(): array
  43.     {
  44.         return [ 'ROLE_API_CLIENT' ];
  45.     }
  46.     public function getPassword(): ?string
  47.     {
  48.     }
  49.     public function getSalt(): ?string
  50.     {
  51.     }
  52.     public function eraseCredentials()
  53.     {
  54.     }
  55.     /**
  56.      * @var DateTime
  57.      *
  58.      * @ORM\Column(name="createdAt", type="datetime", nullable=false)
  59.      */
  60.     protected $createdAt;
  61.     /**
  62.      * @var DateTime
  63.      *
  64.      * @ORM\Column(name="updatedAt", type="datetime", nullable=true)
  65.      */
  66.     protected $updatedAt;
  67.     /**
  68.      * Set createdAt
  69.      *
  70.      * @return Cart
  71.      * @ORM\PrePersist
  72.      */
  73.     public function setCreatedAt()
  74.     {
  75.         $this->createdAt = new DateTime();
  76.         $this->updatedAt = new DateTime();
  77.         return $this;
  78.     }
  79.     /**
  80.      * @return DateTime
  81.      */
  82.     public function getUpdatedAt()
  83.     {
  84.         return $this->updatedAt;
  85.     }
  86.     /**
  87.      * Set updatedAt
  88.      *
  89.      * @return Cart
  90.      * @ORM\PreUpdate
  91.      */
  92.     public function setUpdatedAt()
  93.     {
  94.         $this->updatedAt = new DateTime();
  95.         return $this;
  96.     }
  97.     /**
  98.      * @return mixed
  99.      */
  100.     public function getApiKey()
  101.     {
  102.         return $this->apiKey;
  103.     }
  104.     /**
  105.      * @param mixed $apiKey
  106.      */
  107.     public function setApiKey($apiKey)
  108.     {
  109.         $this->apiKey   $apiKey;
  110.         $this->username $apiKey;
  111.     }
  112.     /**
  113.      * @return bool
  114.      */
  115.     public function isEnabled()
  116.     {
  117.         return $this->enabled;
  118.     }
  119.     /**
  120.      * @param bool $enabled
  121.      */
  122.     public function setEnabled($enabled)
  123.     {
  124.         $this->enabled $enabled;
  125.     }
  126.     /**
  127.      * @return mixed
  128.      */
  129.     public function getName()
  130.     {
  131.         return $this->name;
  132.     }
  133.     /**
  134.      * @param mixed $name
  135.      */
  136.     public function setName($name)
  137.     {
  138.         $this->name $name;
  139.     }
  140.     /**
  141.      * @return mixed
  142.      */
  143.     public function getId()
  144.     {
  145.         return $this->id;
  146.     }
  147.     /**
  148.      * @param mixed $id
  149.      */
  150.     public function setId($id)
  151.     {
  152.         $this->id $id;
  153.     }
  154.     public function getUserIdentifier(): string
  155.     {
  156.         return $this->username;
  157.     }
  158. }