From 23406ca3f12303759ecb46974d6bcb22fb0e037b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 24 Oct 2016 21:56:28 +0200 Subject: Added relation between API Client and User Fix #2062 --- src/Wallabag/ApiBundle/Entity/Client.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/ApiBundle/Entity/Client.php') 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; use Doctrine\ORM\Mapping as ORM; use FOS\OAuthServerBundle\Entity\Client as BaseClient; +use Wallabag\UserBundle\Entity\User; /** * @ORM\Table("oauth2_clients") @@ -35,9 +36,15 @@ class Client extends BaseClient */ protected $accessTokens; - public function __construct() + /** + * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="clients") + */ + private $user; + + public function __construct(User $user) { parent::__construct(); + $this->user = $user; } /** @@ -63,4 +70,12 @@ class Client extends BaseClient return $this; } + + /** + * @return User + */ + public function getUser() + { + return $this->user; + } } -- cgit v1.2.3 From 3ef75cc4e327146513ff077d69de65c8f93b775c Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 19 Dec 2016 14:24:19 +0100 Subject: Be consistent between migration & schema definition --- src/Wallabag/ApiBundle/Entity/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/ApiBundle/Entity/Client.php') diff --git a/src/Wallabag/ApiBundle/Entity/Client.php b/src/Wallabag/ApiBundle/Entity/Client.php index 427a4c7f..9ed9f980 100644 --- a/src/Wallabag/ApiBundle/Entity/Client.php +++ b/src/Wallabag/ApiBundle/Entity/Client.php @@ -22,7 +22,7 @@ class Client extends BaseClient /** * @var string * - * @ORM\Column(name="name", type="text", nullable=true) + * @ORM\Column(name="name", type="text", nullable=false) */ protected $name; -- cgit v1.2.3