fork download
  1. <?php
  2.  
  3. namespace ISLab\Bundle\ECommerceBundle\Entity;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. /**
  8.  * Category
  9.  *
  10.  * @ORM\Table(name="ecomerce_categories")
  11.  * @ORM\HasLifecycleCallbacks()
  12.  * @ORM\Entity(repositoryClass="ISLab\Bundle\ECommerceBundle\Repository\CategoryRepository")
  13.  */
  14. class Category
  15. {
  16. /**
  17.   * @var integer
  18.   *
  19.   * @ORM\Column(name="id", type="integer")
  20.   * @ORM\Id
  21.   * @ORM\GeneratedValue(strategy="AUTO")
  22.   */
  23. private $id;
  24.  
  25. /**
  26.   * @var string
  27.   *
  28.   * @ORM\Column(name="name", type="string", length=255)
  29.   */
  30. private $name;
  31.  
  32. /**
  33.   * @var integer
  34.   *
  35.   * @ORM\Column(name="image", type="integer")
  36.   */
  37. private $image;
  38.  
  39. /**
  40.   * @var category
  41.   *
  42.   * @ORM\OneToMany(targetEntity="category", mappedBy="parent")
  43.   */
  44. private $children;
  45.  
  46. /**
  47.   * @var ArrayCollection
  48.   *
  49.   * @ORM\ManyToOne(targetEntity="category", inversedBy="children")
  50.   * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
  51.   */
  52. private $parent;
  53.  
  54. /**
  55.   * @var integer
  56.   *
  57.   * @ORM\Column(name="status", type="integer")
  58.   */
  59. private $status;
  60.  
  61. /**
  62.   * @var string
  63.   *
  64.   * @ORM\Column(name="page_title", type="string", length=255)
  65.   */
  66. private $pageTitle;
  67.  
  68. /**
  69.   * @var string
  70.   *
  71.   * @ORM\Column(name="meta_keywords", type="text")
  72.   */
  73. private $metaKeywords;
  74.  
  75. /**
  76.   * @var string
  77.   *
  78.   * @ORM\Column(name="meta_description", type="text")
  79.   */
  80. private $metaDescription;
  81.  
  82. /**
  83.   * @var string
  84.   *
  85.   * @ORM\Column(name="description", type="text")
  86.   */
  87. private $description;
  88. /**
  89.   * @var \DateTime
  90.   *
  91.   * @ORM\Column(name="date_created", type="datetime")
  92.   */
  93. private $dateCreated;
  94.  
  95. /**
  96.   * @var \DateTime
  97.   *
  98.   * @ORM\Column(name="date_modified", type="datetime")
  99.   */
  100. private $dateModified;
  101.  
  102. /**
  103.   * Constructor
  104.   *
  105.   * ArrayCollection
  106.   */
  107. public function __construct()
  108. {
  109. $this->children = new ArrayCollection();
  110. }
  111.  
  112. /**
  113.   * To String
  114.   *
  115.   * @return string
  116.   */
  117. public function __toString()
  118. {
  119. return (string) $this->name;
  120. }
  121.  
  122. /**
  123.   * Get id
  124.   *
  125.   * @return integer
  126.   */
  127. public function getId()
  128. {
  129. return $this->id;
  130. }
  131.  
  132. /**
  133.   * Set name
  134.   *
  135.   * @param string $name
  136.   * @return Category
  137.   */
  138. public function setName($name)
  139. {
  140. $this->name = $name;
  141.  
  142. return $this;
  143. }
  144.  
  145. /**
  146.   * Get name
  147.   *
  148.   * @return string
  149.   */
  150. public function getName()
  151. {
  152. return $this->name;
  153. }
  154.  
  155. /**
  156.   * Set image
  157.   *
  158.   * @param integer $image
  159.   * @return Category
  160.   */
  161. public function setImage($image)
  162. {
  163. $this->image = $image;
  164.  
  165. return $this;
  166. }
  167.  
  168. /**
  169.   * Get image
  170.   *
  171.   * @return integer
  172.   */
  173. public function getImage()
  174. {
  175. return $this->image;
  176. }
  177.  
  178. /**
  179.   * Set parent
  180.   *
  181.   * @param integer $parent
  182.   * @return Category
  183.   */
  184. public function setParent($parent)
  185. {
  186. $this->parent = $parent;
  187.  
  188. return $this;
  189. }
  190.  
  191. /**
  192.   * Get parent
  193.   *
  194.   * @return integer
  195.   */
  196. public function getParent()
  197. {
  198. return $this->parent;
  199. }
  200.  
  201. /**
  202.   * Set status
  203.   *
  204.   * @param integer $status
  205.   * @return Category
  206.   */
  207. public function setStatus($status)
  208. {
  209. $this->status = $status;
  210.  
  211. return $this;
  212. }
  213.  
  214. /**
  215.   * Get status
  216.   *
  217.   * @return integer
  218.   */
  219. public function getStatus()
  220. {
  221. return $this->status;
  222. }
  223.  
  224. /**
  225.   * Set pageTitle
  226.   *
  227.   * @param string $pageTitle
  228.   * @return Category
  229.   */
  230. public function setPageTitle($pageTitle)
  231. {
  232. $this->pageTitle = $pageTitle;
  233.  
  234. return $this;
  235. }
  236.  
  237. /**
  238.   * Get pageTitle
  239.   *
  240.   * @return string
  241.   */
  242. public function getPageTitle()
  243. {
  244. return $this->pageTitle;
  245. }
  246.  
  247. /**
  248.   * Set metaKeywords
  249.   *
  250.   * @param string $metaKeywords
  251.   * @return Category
  252.   */
  253. public function setMetaKeywords($metaKeywords)
  254. {
  255. $this->metaKeywords = $metaKeywords;
  256.  
  257. return $this;
  258. }
  259.  
  260. /**
  261.   * Get metaKeywords
  262.   *
  263.   * @return string
  264.   */
  265. public function getMetaKeywords()
  266. {
  267. return $this->metaKeywords;
  268. }
  269.  
  270. /**
  271.   * Set metaDescription
  272.   *
  273.   * @param string $metaDescription
  274.   * @return Category
  275.   */
  276. public function setMetaDescription($metaDescription)
  277. {
  278. $this->metaDescription = $metaDescription;
  279.  
  280. return $this;
  281. }
  282.  
  283. /**
  284.   * Get metaDescription
  285.   *
  286.   * @return string
  287.   */
  288. public function getMetaDescription()
  289. {
  290. return $this->metaDescription;
  291. }
  292.  
  293. /**
  294.   * Set description
  295.   *
  296.   * @param string $description
  297.   * @return Category
  298.   */
  299. public function setDescription($description)
  300. {
  301. $this->description = $description;
  302.  
  303. return $this;
  304. }
  305.  
  306. /**
  307.   * Get description
  308.   *
  309.   * @return string
  310.   */
  311. public function getDescription()
  312. {
  313. return $this->description;
  314. }
  315.  
  316. /**
  317.   * Set dateCreated
  318.   *
  319.   * @ORM\PrePersist
  320.   *
  321.   * @return Category
  322.   */
  323. public function setDateCreated()
  324. {
  325. $this->dateCreated = new \DateTime();
  326.  
  327. return $this;
  328. }
  329.  
  330. /**
  331.   * Get dateCreated
  332.   *
  333.   * @return \DateTime
  334.   */
  335. public function getDateCreated()
  336. {
  337. return $this->dateCreated;
  338. }
  339.  
  340. /**
  341.   * Set dateModified
  342.   *
  343.   * @ORM\PrePersist
  344.   * @ORM\PreUpdate
  345.   *
  346.   * @return Category
  347.   */
  348. public function setDateModified()
  349. {
  350. $this->dateModified = new \DateTime();
  351.  
  352. return $this;
  353. }
  354.  
  355. /**
  356.   * Get dateModified
  357.   *
  358.   * @return \DateTime
  359.   */
  360. public function getDateModified()
  361. {
  362. return $this->dateModified;
  363. }
  364.  
  365. public function setChildren($children) { //this will be an array collection so please pay attention
  366. $this->children = $children;
  367.  
  368. return $this;
  369. }
  370.  
  371. public function getChildren() {
  372. return $this->children;
  373. }
  374.  
  375. }
  376.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Standard output is empty