X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FApiBundle%2FEntity%2FClient.php;h=427a4c7fed9b7ab3eb92119be7320d1e0f03b709;hb=5a619812ca3eb05a82a023ccdaee13501eb8d45f;hp=3e2f491c012ad94e43609dad08ce4ea6b0a335ed;hpb=637aa17e6b52dd8021854a809053560a27caca72;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ApiBundle/Entity/Client.php b/src/Wallabag/ApiBundle/Entity/Client.php index 3e2f491c..427a4c7f 100644 --- a/src/Wallabag/ApiBundle/Entity/Client.php +++ b/src/Wallabag/ApiBundle/Entity/Client.php @@ -4,6 +4,7 @@ namespace Wallabag\ApiBundle\Entity; use Doctrine\ORM\Mapping as ORM; use FOS\OAuthServerBundle\Entity\Client as BaseClient; +use Wallabag\UserBundle\Entity\User; /** * @ORM\Table("oauth2_clients") @@ -25,9 +26,25 @@ class Client extends BaseClient */ protected $name; - public function __construct() + /** + * @ORM\OneToMany(targetEntity="RefreshToken", mappedBy="client", cascade={"remove"}) + */ + protected $refreshTokens; + + /** + * @ORM\OneToMany(targetEntity="AccessToken", mappedBy="client", cascade={"remove"}) + */ + protected $accessTokens; + + /** + * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="clients") + */ + private $user; + + public function __construct(User $user) { parent::__construct(); + $this->user = $user; } /** @@ -53,4 +70,12 @@ class Client extends BaseClient return $this; } + + /** + * @return User + */ + public function getUser() + { + return $this->user; + } }