src/App/Entity/OAuth2/App/AbstractAppToken.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\OAuth2\App;
  3. use App\Entity\OAuth2\AbstractToken;
  4. use App\Service\OAuth2\AppClientRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use League\OAuth2\Server\Entities\ClientEntityInterface;
  7. use Products\NotificationsBundle\Entity\Profile;
  8. /**
  9.  * @ORM\Entity(
  10.  *     repositoryClass = "App\Doctrine\Repository\OAuth2\App\AppTokenRepository",
  11.  * )
  12.  */
  13. abstract class AbstractAppToken extends AbstractToken
  14. {
  15.     public const DISCR 'app';
  16.     /**
  17.      * @var Profile|null
  18.      *
  19.      * @ORM\ManyToOne(
  20.      *     targetEntity = Profile::class,
  21.      *     inversedBy = "tokens",
  22.      * )
  23.      * @ORM\JoinColumn(
  24.      *     name = "profile",
  25.      *     referencedColumnName = "id",
  26.      *     nullable = true,
  27.      *     onDelete = "CASCADE",
  28.      * )
  29.      */
  30.     protected ?Profile $profile null;
  31.     /**
  32.      * @return Profile|null
  33.      */
  34.     public function getProfile(): ?Profile
  35.     {
  36.         return $this->profile;
  37.     }
  38.     /**
  39.      * @param Profile $profile
  40.      * @return $this
  41.      */
  42.     public function setProfile(Profile $profile): self
  43.     {
  44.         $this->profile $profile;
  45.         return $this;
  46.     }
  47.     /**
  48.      * {@inheritdoc}
  49.      */
  50.     public function getClient(): ClientEntityInterface
  51.     {
  52.         return AppClientRepository::getInstance()->getClientEntity(
  53.             $this->client
  54.         );
  55.     }
  56. }