]>
Commit | Line | Data |
---|---|---|
f92fcb53 JB |
1 | <?php |
2 | ||
3 | namespace Wallabag\CoreBundle\Entity; | |
4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | |
6 | use Symfony\Component\Validator\Constraints as Assert; | |
927c9e79 | 7 | use Wallabag\CoreBundle\Helper\EntityTimestampsTrait; |
f92fcb53 JB |
8 | use Wallabag\UserBundle\Entity\User; |
9 | ||
10 | /** | |
11 | * SiteCredential. | |
12 | * | |
13 | * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\SiteCredentialRepository") | |
14 | * @ORM\Table(name="`site_credential`") | |
15 | * @ORM\HasLifecycleCallbacks() | |
16 | */ | |
17 | class SiteCredential | |
18 | { | |
927c9e79 JB |
19 | use EntityTimestampsTrait; |
20 | ||
f92fcb53 JB |
21 | /** |
22 | * @var int | |
23 | * | |
24 | * @ORM\Column(name="id", type="integer") | |
25 | * @ORM\Id | |
26 | * @ORM\GeneratedValue(strategy="AUTO") | |
27 | */ | |
28 | private $id; | |
29 | ||
30 | /** | |
31 | * @var string | |
32 | * | |
33 | * @Assert\NotBlank() | |
34 | * @Assert\Length(max=255) | |
35 | * @ORM\Column(name="host", type="string", length=255) | |
36 | */ | |
37 | private $host; | |
38 | ||
39 | /** | |
40 | * @var string | |
41 | * | |
42 | * @Assert\NotBlank() | |
bead8b42 | 43 | * @ORM\Column(name="username", type="text") |
f92fcb53 JB |
44 | */ |
45 | private $username; | |
46 | ||
47 | /** | |
48 | * @var string | |
49 | * | |
50 | * @Assert\NotBlank() | |
906424c1 | 51 | * @ORM\Column(name="password", type="text") |
f92fcb53 JB |
52 | */ |
53 | private $password; | |
54 | ||
55 | /** | |
56 | * @var \DateTime | |
57 | * | |
58 | * @ORM\Column(name="createdAt", type="datetime") | |
59 | */ | |
60 | private $createdAt; | |
61 | ||
62 | /** | |
e50d7d31 | 63 | * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="siteCredentials") |
f92fcb53 JB |
64 | */ |
65 | private $user; | |
66 | ||
67 | /* | |
68 | * @param User $user | |
69 | */ | |
70 | public function __construct(User $user) | |
71 | { | |
72 | $this->user = $user; | |
73 | } | |
74 | ||
75 | /** | |
76 | * Get id. | |
77 | * | |
78 | * @return int | |
79 | */ | |
80 | public function getId() | |
81 | { | |
82 | return $this->id; | |
83 | } | |
84 | ||
85 | /** | |
86 | * Set host. | |
87 | * | |
88 | * @param string $host | |
89 | * | |
90 | * @return SiteCredential | |
91 | */ | |
92 | public function setHost($host) | |
93 | { | |
94 | $this->host = $host; | |
95 | ||
96 | return $this; | |
97 | } | |
98 | ||
99 | /** | |
100 | * Get host. | |
101 | * | |
102 | * @return string | |
103 | */ | |
104 | public function getHost() | |
105 | { | |
106 | return $this->host; | |
107 | } | |
108 | ||
109 | /** | |
110 | * Set username. | |
111 | * | |
112 | * @param string $username | |
113 | * | |
114 | * @return SiteCredential | |
115 | */ | |
116 | public function setUsername($username) | |
117 | { | |
118 | $this->username = $username; | |
119 | ||
120 | return $this; | |
121 | } | |
122 | ||
123 | /** | |
124 | * Get username. | |
125 | * | |
126 | * @return string | |
127 | */ | |
128 | public function getUsername() | |
129 | { | |
130 | return $this->username; | |
131 | } | |
132 | ||
133 | /** | |
134 | * Set password. | |
135 | * | |
136 | * @param string $password | |
137 | * | |
138 | * @return SiteCredential | |
139 | */ | |
140 | public function setPassword($password) | |
141 | { | |
142 | $this->password = $password; | |
143 | ||
144 | return $this; | |
145 | } | |
146 | ||
147 | /** | |
148 | * Get password. | |
149 | * | |
150 | * @return string | |
151 | */ | |
152 | public function getPassword() | |
153 | { | |
154 | return $this->password; | |
155 | } | |
156 | ||
157 | /** | |
158 | * Set createdAt. | |
159 | * | |
160 | * @param \DateTime $createdAt | |
161 | * | |
162 | * @return SiteCredential | |
163 | */ | |
164 | public function setCreatedAt($createdAt) | |
165 | { | |
166 | $this->createdAt = $createdAt; | |
167 | ||
168 | return $this; | |
169 | } | |
170 | ||
171 | /** | |
172 | * Get createdAt. | |
173 | * | |
174 | * @return \DateTime | |
175 | */ | |
176 | public function getCreatedAt() | |
177 | { | |
178 | return $this->createdAt; | |
179 | } | |
180 | ||
181 | /** | |
182 | * @return User | |
183 | */ | |
184 | public function getUser() | |
185 | { | |
186 | return $this->user; | |
187 | } | |
f92fcb53 | 188 | } |