]>
Commit | Line | Data |
---|---|---|
fcb1fba5 NL |
1 | <?php |
2 | ||
3 | namespace Wallabag\ApiBundle\Entity; | |
4 | ||
fcb1fba5 | 5 | use Doctrine\ORM\Mapping as ORM; |
619cc453 | 6 | use FOS\OAuthServerBundle\Entity\Client as BaseClient; |
23406ca3 | 7 | use Wallabag\UserBundle\Entity\User; |
fcb1fba5 NL |
8 | |
9 | /** | |
10 | * @ORM\Table("oauth2_clients") | |
11 | * @ORM\Entity | |
12 | */ | |
13 | class Client extends BaseClient | |
14 | { | |
15 | /** | |
16 | * @ORM\Id | |
17 | * @ORM\Column(type="integer") | |
18 | * @ORM\GeneratedValue(strategy="AUTO") | |
19 | */ | |
20 | protected $id; | |
21 | ||
9c545fe0 TC |
22 | /** |
23 | * @var string | |
24 | * | |
25 | * @ORM\Column(name="name", type="text", nullable=true) | |
26 | */ | |
27 | protected $name; | |
28 | ||
b0da721a NL |
29 | /** |
30 | * @ORM\OneToMany(targetEntity="RefreshToken", mappedBy="client", cascade={"remove"}) | |
31 | */ | |
32 | protected $refreshTokens; | |
33 | ||
ee32248f JB |
34 | /** |
35 | * @ORM\OneToMany(targetEntity="AccessToken", mappedBy="client", cascade={"remove"}) | |
36 | */ | |
37 | protected $accessTokens; | |
38 | ||
23406ca3 NL |
39 | /** |
40 | * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="clients") | |
41 | */ | |
42 | private $user; | |
43 | ||
44 | public function __construct(User $user) | |
fcb1fba5 NL |
45 | { |
46 | parent::__construct(); | |
23406ca3 | 47 | $this->user = $user; |
fcb1fba5 | 48 | } |
9c545fe0 TC |
49 | |
50 | /** | |
51 | * Get name. | |
52 | * | |
53 | * @return string | |
54 | */ | |
55 | public function getName() | |
56 | { | |
57 | return $this->name; | |
58 | } | |
59 | ||
60 | /** | |
61 | * Set name. | |
62 | * | |
63 | * @param string $name | |
64 | * | |
65 | * @return Client | |
66 | */ | |
67 | public function setName($name) | |
68 | { | |
69 | $this->name = $name; | |
70 | ||
71 | return $this; | |
72 | } | |
23406ca3 NL |
73 | |
74 | /** | |
75 | * @return User | |
76 | */ | |
77 | public function getUser() | |
78 | { | |
79 | return $this->user; | |
80 | } | |
fcb1fba5 | 81 | } |