<?php
namespace App\Entity;
use App\Repository\ClientTokenRepository;
use Doctrine\ORM\Mapping as ORM;
use phpDocumentor\Reflection\Types\Integer;
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
#[ORM\Entity(repositoryClass: ClientTokenRepository::class)]
#[ORM\Table(name: "client_token")]
class ClientToken extends AbstractToken
{
#[ORM\Id]
#[ORM\Column(type: "integer")]
#[ORM\GeneratedValue(strategy: "AUTO")]
private $id;
#[ORM\Column(length: 255)]
private $value;
#[ORM\Column(type:"datetime")]
private $expiresAt;
#[ORM\Column(type: "integer")]
private $userId;
public function getId(): ?int
{
return $this->id;
}
public function getValue(): ?string
{
return $this->value;
}
public function setValue(string $value): self
{
$this->value = $value;
return $this;
}
public function getExpiresAt(): ?\DateTimeInterface
{
return $this->expiresAt;
}
public function setExpiresAt(\DateTimeInterface $expiresAt): self
{
$this->expiresAt = $expiresAt;
return $this;
}
public function getUserId(): ?string
{
return $this->userId;
}
public function setUserId(string $userId): self
{
$this->userId = $userId;
return $this;
}
public function isValid():bool
{
return $this->expiresAt > new \DateTime('now');
}
}