/application/models/Entities/User.php

https://github.com/Sa-ryong/Stadioom-php · PHP · 333 lines · 127 code · 44 blank · 162 comment · 2 complexity · 73cd0e7d2995512084e897f321b65fd5 MD5 · raw file

  1. <?php
  2. namespace Entities;
  3. /**
  4. * Entities\User
  5. */
  6. class User
  7. {
  8. /**
  9. * @var integer $id
  10. */
  11. private $id;
  12. /**
  13. * @var string $fbId
  14. */
  15. private $fbId;
  16. /**
  17. * @var boolean $fbLinked
  18. */
  19. private $fbLinked;
  20. /**
  21. * @var boolean $fbAuthorized
  22. */
  23. private $fbAuthorized;
  24. /**
  25. * @var string $password
  26. */
  27. private $password;
  28. /**
  29. * @var string $name
  30. */
  31. private $name;
  32. /**
  33. * @var string $email
  34. */
  35. private $email;
  36. /**
  37. * @var string $gender
  38. */
  39. private $gender;
  40. /**
  41. * @var datetime $dob
  42. */
  43. private $dob;
  44. /**
  45. * @var boolean $verified
  46. */
  47. private $verified;
  48. /**
  49. * @var datetime $created
  50. */
  51. private $created;
  52. /**
  53. * @var datetime $lastUpdated
  54. */
  55. private $lastUpdated;
  56. /**
  57. * Get id
  58. *
  59. * @return integer $id
  60. */
  61. public function getId()
  62. {
  63. return $this->id;
  64. }
  65. /**
  66. * Set fbId
  67. *
  68. * @param string $fbId
  69. */
  70. public function setFbId($fbId)
  71. {
  72. $this->fbId = $fbId;
  73. }
  74. /**
  75. * Get fbId
  76. *
  77. * @return string $fbId
  78. */
  79. public function getFbId()
  80. {
  81. return $this->fbId;
  82. }
  83. /**
  84. * Set fbLinked
  85. *
  86. * @param boolean $fbLinked
  87. */
  88. public function setFbLinked($fbLinked)
  89. {
  90. $this->fbLinked = $fbLinked;
  91. }
  92. /**
  93. * Get fbLinked
  94. *
  95. * @return boolean $fbLinked
  96. */
  97. public function getFbLinked()
  98. {
  99. return $this->fbLinked;
  100. }
  101. /**
  102. * Set fbAuthorized
  103. *
  104. * @param boolean $fbAuthorized
  105. */
  106. public function setFbAuthorized($fbAuthorized)
  107. {
  108. $this->fbAuthorized = $fbAuthorized;
  109. }
  110. /**
  111. * Get fbAuthorized
  112. *
  113. * @return boolean $fbAuthorized
  114. */
  115. public function getFbAuthorized()
  116. {
  117. return $this->fbAuthorized;
  118. }
  119. /**
  120. * Set password
  121. *
  122. * @param string $password
  123. */
  124. public function setPassword($password)
  125. {
  126. $this->password = $password;
  127. }
  128. /**
  129. * Get password
  130. *
  131. * @return string $password
  132. */
  133. public function getPassword()
  134. {
  135. return $this->password;
  136. }
  137. /**
  138. * Set name
  139. *
  140. * @param string $name
  141. */
  142. public function setName($name)
  143. {
  144. $this->name = $name;
  145. }
  146. /**
  147. * Get name
  148. *
  149. * @return string $name
  150. */
  151. public function getName()
  152. {
  153. return $this->name;
  154. }
  155. /**
  156. * Set email
  157. *
  158. * @param string $email
  159. */
  160. public function setEmail($email)
  161. {
  162. $this->email = $email;
  163. }
  164. /**
  165. * Get email
  166. *
  167. * @return string $email
  168. */
  169. public function getEmail()
  170. {
  171. return $this->email;
  172. }
  173. /**
  174. * Set gender
  175. *
  176. * @param string $gender
  177. */
  178. public function setGender($gender)
  179. {
  180. $this->gender = $gender;
  181. }
  182. /**
  183. * Get gender
  184. *
  185. * @return string $gender
  186. */
  187. public function getGender()
  188. {
  189. return $this->gender;
  190. }
  191. /**
  192. * Set dob
  193. *
  194. * @param datetime $dob
  195. */
  196. public function setDob($dob)
  197. {
  198. $this->dob = $dob;
  199. }
  200. /**
  201. * Get dob
  202. *
  203. * @return datetime $dob
  204. */
  205. public function getDob()
  206. {
  207. return $this->dob;
  208. }
  209. /**
  210. * Set verified
  211. *
  212. * @param boolean $verified
  213. */
  214. public function setVerified($verified)
  215. {
  216. $this->verified = $verified;
  217. }
  218. /**
  219. * Get verified
  220. *
  221. * @return boolean $verified
  222. */
  223. public function getVerified()
  224. {
  225. return $this->verified;
  226. }
  227. /**
  228. * Set created
  229. *
  230. * @param datetime $created
  231. */
  232. public function setCreated($created)
  233. {
  234. $this->created = $created;
  235. }
  236. /**
  237. * Get created
  238. *
  239. * @return datetime $created
  240. */
  241. public function getCreated()
  242. {
  243. return $this->created;
  244. }
  245. /**
  246. * Set lastUpdated
  247. *
  248. * @param datetime $lastUpdated
  249. */
  250. public function setLastUpdated($lastUpdated)
  251. {
  252. $this->lastUpdated = $lastUpdated;
  253. }
  254. /**
  255. * Get lastUpdated
  256. *
  257. * @return datetime $lastUpdated
  258. */
  259. public function getLastUpdated()
  260. {
  261. return $this->lastUpdated;
  262. }
  263. /**
  264. * @prePersist
  265. */
  266. public function prePersist() {
  267. // $gmt = strtotime(gmdate("M d Y H:i:s", time()));
  268. $gmt = new \DateTime("now", new \DateTimeZone("GMT"));
  269. if ($this->created == null) {
  270. $this->created = $gmt;
  271. }
  272. $this->lastUpdated = $gmt;
  273. }
  274. /**
  275. * @preUpdate
  276. */
  277. public function preUpdate() {
  278. // $gmt = strtotime(gmdate("M d Y H:i:s", time()));
  279. $gmt = new \DateTime("now", new \DateTimeZone("GMT"));
  280. $this->lastUpdated = $gmt;
  281. }
  282. public function toArray() {
  283. $array = get_object_vars($this);
  284. $format = "Y-m-d H:i:s";
  285. $array['created'] = $this->getCreated()->format($format);
  286. $array['lastUpdated'] = $this->getLastUpdated()->format($format);
  287. return $array;
  288. }
  289. }