vendor/uvdesk/support-center-bundle/Entity/Article.php line 14

Open in your IDE?
  1. <?php
  2. namespace Webkul\UVDesk\SupportCenterBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\HttpFoundation\File\UploadedFile;
  5. /**
  6. * Article
  7. * @ORM\Entity(repositoryClass="Webkul\UVDesk\SupportCenterBundle\Repository\Article")
  8. * @ORM\HasLifecycleCallbacks
  9. * @ORM\Table(name="uv_article", indexes={@ORM\Index(name="search_idx", columns={"slug"})})
  10. */
  11. class Article
  12. {
  13. /**
  14. * @var integer
  15. * @ORM\Id
  16. * @ORM\Column(type="integer")
  17. * @ORM\GeneratedValue
  18. */
  19. private $id;
  20. /**
  21. * @var string
  22. * @ORM\Column(type="string", length=255)
  23. */
  24. private $name;
  25. /**
  26. * @var string
  27. * @ORM\Column(type="string", length=255, nullable=true)
  28. */
  29. private $slug;
  30. /**
  31. * @var string
  32. * @ORM\Column(type="text")
  33. */
  34. private $content;
  35. /**
  36. * @var string
  37. */
  38. public $contentFile;
  39. /**
  40. * @var string
  41. * @ORM\Column(type="text", length=2000, nullable=true, name="meta_description")
  42. */
  43. private $metaDescription;
  44. /**
  45. * @var string
  46. * @ORM\Column(type="string", length=255, nullable=true)
  47. */
  48. private $keywords;
  49. /**
  50. * @var integer
  51. * @ORM\Column(type="integer", nullable=true)
  52. */
  53. private $viewed;
  54. /**
  55. * @var integer
  56. * @ORM\Column(type="integer", nullable=true, options={"default": 0})
  57. */
  58. private $status;
  59. /**
  60. * @var \DateTime
  61. * @ORM\Column(type="datetime", name="date_added")
  62. */
  63. private $dateAdded;
  64. /**
  65. * @var \DateTime
  66. * @ORM\Column(type="datetime", name="date_updated")
  67. */
  68. private $dateUpdated;
  69. /**
  70. * @var array
  71. */
  72. public $category;
  73. /**
  74. * Get id
  75. *
  76. * @return integer
  77. */
  78. public function getId()
  79. {
  80. return $this->id;
  81. }
  82. /**
  83. * Set name
  84. *
  85. * @param string $name
  86. * @return Article
  87. */
  88. public function setName($name)
  89. {
  90. $this->name = $name;
  91. return $this;
  92. }
  93. /**
  94. * Get name
  95. *
  96. * @return string
  97. */
  98. public function getName()
  99. {
  100. return $this->name;
  101. }
  102. /**
  103. * Set slug
  104. *
  105. * @param string $slug
  106. * @return Article
  107. */
  108. public function setSlug($slug)
  109. {
  110. $this->slug = $slug;
  111. return $this;
  112. }
  113. /**
  114. * Get slug
  115. *
  116. * @return string
  117. */
  118. public function getSlug()
  119. {
  120. return $this->slug;
  121. }
  122. /**
  123. * Set content
  124. *
  125. * @param string $content
  126. * @return Article
  127. */
  128. public function setContent($content)
  129. {
  130. $this->content = $content;
  131. return $this;
  132. }
  133. /**
  134. * Get content
  135. *
  136. * @return string
  137. */
  138. public function getContent()
  139. {
  140. return $this->content;
  141. }
  142. /**
  143. * Set metaDescription
  144. *
  145. * @param string $metaDescription
  146. * @return Article
  147. */
  148. public function setMetaDescription($metaDescription)
  149. {
  150. $this->metaDescription = $metaDescription;
  151. return $this;
  152. }
  153. /**
  154. * Get metaDescription
  155. *
  156. * @return string
  157. */
  158. public function getMetaDescription()
  159. {
  160. return $this->metaDescription;
  161. }
  162. /**
  163. * Set keywords
  164. *
  165. * @param string $keywords
  166. * @return Article
  167. */
  168. public function setKeywords($keywords)
  169. {
  170. $this->keywords = $keywords;
  171. return $this;
  172. }
  173. /**
  174. * Get keywords
  175. *
  176. * @return string
  177. */
  178. public function getKeywords()
  179. {
  180. return $this->keywords;
  181. }
  182. /**
  183. * Set viewed
  184. *
  185. * @param integer $viewed
  186. * @return Article
  187. */
  188. public function setViewed($viewed)
  189. {
  190. $this->viewed = $viewed;
  191. return $this;
  192. }
  193. /**
  194. * Get viewed
  195. *
  196. * @return integer
  197. */
  198. public function getViewed()
  199. {
  200. return $this->viewed;
  201. }
  202. /**
  203. * Set status
  204. *
  205. * @param integer $status
  206. * @return Article
  207. */
  208. public function setStatus($status)
  209. {
  210. $this->status = $status;
  211. return $this;
  212. }
  213. /**
  214. * Get status
  215. *
  216. * @return integer
  217. */
  218. public function getStatus()
  219. {
  220. return $this->status;
  221. }
  222. /**
  223. * Set dateAdded
  224. *
  225. * @param \DateTime $dateAdded
  226. * @return Article
  227. */
  228. public function setDateAdded($dateAdded)
  229. {
  230. $this->dateAdded = $dateAdded;
  231. return $this;
  232. }
  233. /**
  234. * Get dateAdded
  235. *
  236. * @return \DateTime
  237. */
  238. public function getDateAdded()
  239. {
  240. return $this->dateAdded;
  241. }
  242. /**
  243. * Set dateUpdated
  244. *
  245. * @param \DateTime $dateUpdated
  246. * @return Article
  247. *
  248. */
  249. public function setDateUpdated($dateUpdated)
  250. {
  251. $this->dateUpdated = $dateUpdated;
  252. return $this;
  253. }
  254. /**
  255. * Get dateUpdated
  256. *
  257. * @return \DateTime
  258. */
  259. public function getDateUpdated()
  260. {
  261. return $this->dateUpdated;
  262. }
  263. /**
  264. * @ORM\PrePersist
  265. */
  266. public function setCreatedAtValue()
  267. {
  268. $this->dateAdded = new \DateTime();
  269. $this->dateUpdated = new \DateTime();
  270. }
  271. /**
  272. * @ORM\PreUpdate
  273. */
  274. public function setUpdatedAtValue()
  275. {
  276. $this->dateUpdated = new \DateTime();
  277. }
  278. public function setFileHtmlToContent()
  279. {
  280. if (null === $this->contentFile || !($this->contentFile instanceof UploadedFile))
  281. $this->setContent('');
  282. else{
  283. $this->setContent(file_get_contents($this->contentFile->getRealPath()));
  284. }
  285. }
  286. /**
  287. * @var integer
  288. * @ORM\Column(type="integer", nullable=true)
  289. */
  290. private $stared;
  291. /**
  292. * Set stared
  293. *
  294. * @param integer $stared
  295. * @return Article
  296. */
  297. public function setStared($stared)
  298. {
  299. $this->stared = $stared;
  300. return $this;
  301. }
  302. /**
  303. * Get stared
  304. *
  305. * @return integer
  306. */
  307. public function getStared()
  308. {
  309. return $this->stared;
  310. }
  311. /**
  312. * @var string
  313. *
  314. * @ORM\Column(type="string", length=255, nullable=true)
  315. */
  316. private $metaTitle;
  317. /**
  318. * Set metaTitle
  319. *
  320. * @param string $metaTitle
  321. * @return Article
  322. */
  323. public function setMetaTitle($metaTitle)
  324. {
  325. $this->metaTitle = $metaTitle;
  326. return $this;
  327. }
  328. /**
  329. * Get metaTitle
  330. *
  331. * @return string
  332. */
  333. public function getMetaTitle()
  334. {
  335. return $this->metaTitle;
  336. }
  337. }