X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FApiBundle%2FEntity%2FClient.php;h=427a4c7fed9b7ab3eb92119be7320d1e0f03b709;hb=6bb0866cf513bf939eb2e3290d1852c55e51ec0d;hp=3e2f491c012ad94e43609dad08ce4ea6b0a335ed;hpb=e71cef0bb81c80575f38c4ea040716efdfcb17f0;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; + } }