<?phpnamespace App\Entity\OAuth2;use DateTime;use Doctrine\ORM\Mapping as ORM;use League\OAuth2\Server\Entities\ScopeEntityInterface;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use App\Repository\OAuth2\ScopeRepository;/** * @ORM\Table(name="oauth2_scope") * @ORM\Entity(repositoryClass=ScopeRepository::class) * @UniqueEntity(fields={"identifier"}, message="There is already a scope with tis identifier") */class Scope implements ScopeEntityInterface{ /** * @ORM\Id * @ORM\Column(name="id", type="guid") * @ORM\GeneratedValue(strategy="UUID") */ private $identifier; /** * @ORM\Column(type="datetime") */ private $creationDatetime; /** * @ORM\Column(type="string") */ protected $scope; public function __construct() { $this->creationDatetime = new DateTime(); } /** * @return mixed */ public function getIdentifier() { return $this->identifier; } /** * @return DateTime */ public function getCreationDatetime(): DateTime { return $this->creationDatetime; } /** * @param DateTime $creationDatetime * * @return $this */ public function setCreationDatetime(DateTime $creationDatetime): Scope { $this->creationDatetime = $creationDatetime; return $this; } /** * {@inheritdoc} */ public function jsonSerialize() { return $this->getIdentifier(); } public function __toString(): string { return $this->scope; } /** * @return string */ public function getScope(): string { return $this->scope; } /** * @param mixed $scope * * @return $this */ public function setScope(string $scope): Scope { $this->scope = $scope; return $this; }}