aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle/Entity
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2016-10-29 13:20:55 +0200
committerGitHub <noreply@github.com>2016-10-29 13:20:55 +0200
commit5feef9f7a4e6852415feb388190b7ca141f116d1 (patch)
tree773b12c221b089ba508040e855d78f27edb589b0 /src/Wallabag/UserBundle/Entity
parent8e58be9fb62615cdd8f4b55ad0981f57641bf0ab (diff)
parentf08ec5f88a78bfe2edf2c2148094f3f099e8389c (diff)
downloadwallabag-5feef9f7a4e6852415feb388190b7ca141f116d1.tar.gz
wallabag-5feef9f7a4e6852415feb388190b7ca141f116d1.tar.zst
wallabag-5feef9f7a4e6852415feb388190b7ca141f116d1.zip
Merge pull request #2499 from wallabag/add-relation-client-user
Added relation between API Client and User
Diffstat (limited to 'src/Wallabag/UserBundle/Entity')
-rw-r--r--src/Wallabag/UserBundle/Entity/User.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php
index d98ae76a..3a167de7 100644
--- a/src/Wallabag/UserBundle/Entity/User.php
+++ b/src/Wallabag/UserBundle/Entity/User.php
@@ -11,6 +11,7 @@ use JMS\Serializer\Annotation\ExclusionPolicy;
11use JMS\Serializer\Annotation\Expose; 11use JMS\Serializer\Annotation\Expose;
12use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; 12use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
13use Symfony\Component\Security\Core\User\UserInterface; 13use Symfony\Component\Security\Core\User\UserInterface;
14use Wallabag\ApiBundle\Entity\Client;
14use Wallabag\CoreBundle\Entity\Config; 15use Wallabag\CoreBundle\Entity\Config;
15use Wallabag\CoreBundle\Entity\Entry; 16use Wallabag\CoreBundle\Entity\Entry;
16 17
@@ -84,6 +85,11 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
84 */ 85 */
85 private $trusted; 86 private $trusted;
86 87
88 /**
89 * @ORM\OneToMany(targetEntity="Wallabag\ApiBundle\Entity\Client", mappedBy="user", cascade={"remove"})
90 */
91 protected $clients;
92
87 public function __construct() 93 public function __construct()
88 { 94 {
89 parent::__construct(); 95 parent::__construct();
@@ -240,4 +246,24 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
240 246
241 return false; 247 return false;
242 } 248 }
249
250 /**
251 * @param Client $client
252 *
253 * @return User
254 */
255 public function addClient(Client $client)
256 {
257 $this->clients[] = $client;
258
259 return $this;
260 }
261
262 /**
263 * @return ArrayCollection<Entry>
264 */
265 public function getClients()
266 {
267 return $this->clients;
268 }
243} 269}