diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-10-24 21:56:28 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-10-24 21:56:28 +0200 |
commit | 23406ca3f12303759ecb46974d6bcb22fb0e037b (patch) | |
tree | 26ddf8139a0a7de86e13d2cf48b7806bb911971b /src/Wallabag/ApiBundle/Entity/Client.php | |
parent | 8e58be9fb62615cdd8f4b55ad0981f57641bf0ab (diff) | |
download | wallabag-23406ca3f12303759ecb46974d6bcb22fb0e037b.tar.gz wallabag-23406ca3f12303759ecb46974d6bcb22fb0e037b.tar.zst wallabag-23406ca3f12303759ecb46974d6bcb22fb0e037b.zip |
Added relation between API Client and User
Fix #2062
Diffstat (limited to 'src/Wallabag/ApiBundle/Entity/Client.php')
-rw-r--r-- | src/Wallabag/ApiBundle/Entity/Client.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Wallabag/ApiBundle/Entity/Client.php b/src/Wallabag/ApiBundle/Entity/Client.php index f7898ac8..427a4c7f 100644 --- a/src/Wallabag/ApiBundle/Entity/Client.php +++ b/src/Wallabag/ApiBundle/Entity/Client.php | |||
@@ -4,6 +4,7 @@ namespace Wallabag\ApiBundle\Entity; | |||
4 | 4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | 5 | use Doctrine\ORM\Mapping as ORM; |
6 | use FOS\OAuthServerBundle\Entity\Client as BaseClient; | 6 | use FOS\OAuthServerBundle\Entity\Client as BaseClient; |
7 | use Wallabag\UserBundle\Entity\User; | ||
7 | 8 | ||
8 | /** | 9 | /** |
9 | * @ORM\Table("oauth2_clients") | 10 | * @ORM\Table("oauth2_clients") |
@@ -35,9 +36,15 @@ class Client extends BaseClient | |||
35 | */ | 36 | */ |
36 | protected $accessTokens; | 37 | protected $accessTokens; |
37 | 38 | ||
38 | public function __construct() | 39 | /** |
40 | * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="clients") | ||
41 | */ | ||
42 | private $user; | ||
43 | |||
44 | public function __construct(User $user) | ||
39 | { | 45 | { |
40 | parent::__construct(); | 46 | parent::__construct(); |
47 | $this->user = $user; | ||
41 | } | 48 | } |
42 | 49 | ||
43 | /** | 50 | /** |
@@ -63,4 +70,12 @@ class Client extends BaseClient | |||
63 | 70 | ||
64 | return $this; | 71 | return $this; |
65 | } | 72 | } |
73 | |||
74 | /** | ||
75 | * @return User | ||
76 | */ | ||
77 | public function getUser() | ||
78 | { | ||
79 | return $this->user; | ||
80 | } | ||
66 | } | 81 | } |