aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Entity/Client.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/ApiBundle/Entity/Client.php')
-rw-r--r--src/Wallabag/ApiBundle/Entity/Client.php87
1 files changed, 85 insertions, 2 deletions
diff --git a/src/Wallabag/ApiBundle/Entity/Client.php b/src/Wallabag/ApiBundle/Entity/Client.php
index c15fd3fa..24444c9f 100644
--- a/src/Wallabag/ApiBundle/Entity/Client.php
+++ b/src/Wallabag/ApiBundle/Entity/Client.php
@@ -8,6 +8,7 @@ use Wallabag\UserBundle\Entity\User;
8use JMS\Serializer\Annotation\Groups; 8use JMS\Serializer\Annotation\Groups;
9use JMS\Serializer\Annotation\SerializedName; 9use JMS\Serializer\Annotation\SerializedName;
10use JMS\Serializer\Annotation\VirtualProperty; 10use JMS\Serializer\Annotation\VirtualProperty;
11use Symfony\Component\Validator\Constraints as Assert;
11 12
12/** 13/**
13 * @ORM\Table("oauth2_clients") 14 * @ORM\Table("oauth2_clients")
@@ -51,13 +52,39 @@ class Client extends BaseClient
51 52
52 /** 53 /**
53 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="clients") 54 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="clients")
55 * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
54 */ 56 */
55 private $user; 57 private $user;
56 58
57 public function __construct(User $user) 59 /**
60 * @ORM\Column(type="string", nullable=true)
61 */
62 private $image;
63
64 /**
65 * @ORM\Column(type="string", nullable=true)
66 */
67 private $description;
68
69 /**
70 * @ORM\Column(type="string", nullable=true)
71 */
72 private $appUrl;
73
74 /**
75 * @ORM\Column(type="datetime", nullable=true)
76 */
77 private $createdAt;
78
79 /**
80 * Client constructor.
81 * @param User|null $user
82 */
83 public function __construct(User $user = null)
58 { 84 {
59 parent::__construct(); 85 parent::__construct();
60 $this->user = $user; 86 $this->user = $user;
87 $this->createdAt = new \DateTime();
61 } 88 }
62 89
63 /** 90 /**
@@ -99,6 +126,62 @@ class Client extends BaseClient
99 */ 126 */
100 public function getClientId() 127 public function getClientId()
101 { 128 {
102 return $this->getId().'_'.$this->getRandomId(); 129 return $this->getId() . '_' . $this->getRandomId();
130 }
131
132 /**
133 * @return string
134 */
135 public function getImage()
136 {
137 return $this->image;
138 }
139
140 /**
141 * @param string $image
142 */
143 public function setImage($image)
144 {
145 $this->image = $image;
146 }
147
148 /**
149 * @return string
150 */
151 public function getDescription()
152 {
153 return $this->description;
154 }
155
156 /**
157 * @param string $description
158 */
159 public function setDescription($description)
160 {
161 $this->description = $description;
162 }
163
164 /**
165 * @return string
166 */
167 public function getAppUrl()
168 {
169 return $this->appUrl;
170 }
171
172 /**
173 * @param string $appUrl
174 */
175 public function setAppUrl($appUrl)
176 {
177 $this->appUrl = $appUrl;
178 }
179
180 /**
181 * @return \DateTime
182 */
183 public function getCreatedAt()
184 {
185 return $this->createdAt;
103 } 186 }
104} 187}