<?php
namespace App\Entity\OAuth2\App;
use App\Entity\OAuth2\AbstractToken;
use App\Service\OAuth2\AppClientRepository;
use Doctrine\ORM\Mapping as ORM;
use League\OAuth2\Server\Entities\ClientEntityInterface;
use Products\NotificationsBundle\Entity\Profile;
/**
* @ORM\Entity(
* repositoryClass = "App\Doctrine\Repository\OAuth2\App\AppTokenRepository",
* )
*/
abstract class AbstractAppToken extends AbstractToken
{
public const DISCR = 'app';
/**
* @var Profile|null
*
* @ORM\ManyToOne(
* targetEntity = Profile::class,
* inversedBy = "tokens",
* )
* @ORM\JoinColumn(
* name = "profile",
* referencedColumnName = "id",
* nullable = true,
* onDelete = "CASCADE",
* )
*/
protected ?Profile $profile = null;
/**
* @return Profile|null
*/
public function getProfile(): ?Profile
{
return $this->profile;
}
/**
* @param Profile $profile
* @return $this
*/
public function setProfile(Profile $profile): self
{
$this->profile = $profile;
return $this;
}
/**
* {@inheritdoc}
*/
public function getClient(): ClientEntityInterface
{
return AppClientRepository::getInstance()->getClientEntity(
$this->client
);
}
}