]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ApiBundle/Entity/Client.php
Merge remote-tracking branch 'origin/master' into 2.2
[github/wallabag/wallabag.git] / src / Wallabag / ApiBundle / Entity / Client.php
index f7898ac82852292835175581a2ea0b797738ed1d..9ed9f980edb466d2ab696055152c8b5dc088d67d 100644 (file)
@@ -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")
@@ -21,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;
 
@@ -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;
+    }
 }