]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | ||
3 | namespace Wallabag\ApiBundle\Entity; | |
4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | |
6 | use FOS\OAuthServerBundle\Entity\Client as BaseClient; | |
7 | use Wallabag\UserBundle\Entity\User; | |
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 | ||
22 | /** | |
23 | * @var string | |
24 | * | |
25 | * @ORM\Column(name="name", type="text", nullable=false) | |
26 | */ | |
27 | protected $name; | |
28 | ||
29 | /** | |
30 | * @ORM\OneToMany(targetEntity="RefreshToken", mappedBy="client", cascade={"remove"}) | |
31 | */ | |
32 | protected $refreshTokens; | |
33 | ||
34 | /** | |
35 | * @ORM\OneToMany(targetEntity="AccessToken", mappedBy="client", cascade={"remove"}) | |
36 | */ | |
37 | protected $accessTokens; | |
38 | ||
39 | /** | |
40 | * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="clients") | |
41 | */ | |
42 | private $user; | |
43 | ||
44 | public function __construct(User $user) | |
45 | { | |
46 | parent::__construct(); | |
47 | $this->user = $user; | |
48 | } | |
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 | } | |
73 | ||
74 | /** | |
75 | * @return User | |
76 | */ | |
77 | public function getUser() | |
78 | { | |
79 | return $this->user; | |
80 | } | |
81 | } |