X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FApiBundle%2FEntity%2FClient.php;h=9ed9f980edb466d2ab696055152c8b5dc088d67d;hb=f0378b4d7c7b8c971239445f3a2a1535abab7d00;hp=92b2f762d32f7d89d9d1b4501100961a36c07ffc;hpb=b0da721a5238ece3056ae7af760e9455f7af3e11;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ApiBundle/Entity/Client.php b/src/Wallabag/ApiBundle/Entity/Client.php index 92b2f762..9ed9f980 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") @@ -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; @@ -30,9 +31,20 @@ class Client extends BaseClient */ protected $refreshTokens; - public function __construct() + /** + * @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; } /** @@ -58,4 +70,12 @@ class Client extends BaseClient return $this; } + + /** + * @return User + */ + public function getUser() + { + return $this->user; + } }