Guest User

Untitled

a guest
Jul 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. <?php
  2. /**
  3. * ProductCategory
  4. */
  5. namespace XBSAppBundleEntity;
  6.  
  7. use GedmoMappingAnnotation as Gedmo;
  8. use DoctrineORMMapping as ORM;
  9. use SymfonyComponentValidatorConstraints as Assert;
  10.  
  11. /**
  12. * ProductCategory
  13. * @ORMEntity(repositoryClass="AppBundleRepositoryProductCategoryRepository")
  14. * @GedmoTree(type="nested")
  15. * ...
  16. */
  17. class ProductCategory
  18. {
  19.  
  20. /**
  21. * @ORMId
  22. * @ORMColumn(name="id", type="integer")
  23. * @ORMGeneratedValue(strategy="AUTO")
  24. */
  25. protected $id;
  26.  
  27. /**
  28. * @ORMManyToOne(targetEntity="AppBundleEntityProduct", inversedBy="productCategories")
  29. * @AssertNotNull()
  30. */
  31. protected $product;
  32.  
  33. /**
  34. * @GedmoTreeParent
  35. * @ORMManyToOne(targetEntity="AppBundleEntityCategory", inversedBy="productCategories")
  36. * @AssertNotNull()
  37. */
  38. protected $category;
  39.  
  40. /**
  41. * @GedmoTreeParent
  42. * @ORMManyToOne(targetEntity="AppBundleEntityCategory", inversedBy="children" )
  43. * @ORMJoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
  44. */
  45. protected $parent;
  46.  
  47. /**
  48. * @ORMOneToMany(targetEntity="AppBundleEntityCategory", mappedBy="parent")
  49. * @ORMOrderBy({"lft" = "ASC"})
  50. */
  51. protected $children;
  52.  
  53. /**
  54. * Get id
  55. *
  56. * @return integer
  57. */
  58. public function getId()
  59. {
  60. return $this->id;
  61. }
  62.  
  63. /**
  64. * setProduct
  65. *
  66. * @param null $product
  67. * @return $this
  68. */
  69. public function setProduct($product = null)
  70. {
  71. $this->product = $product;
  72.  
  73. return $this;
  74. }
  75.  
  76.  
  77. /**
  78. * getProduct
  79. * @return mixed
  80. */
  81. public function getProduct()
  82. {
  83. return $this->product;
  84. }
  85.  
  86. /**
  87. * setCategory
  88. *
  89. * @param null $category
  90. * @return $this
  91. */
  92. public function setCategory($category = null)
  93. {
  94. $this->category = $category;
  95.  
  96. return $this;
  97. }
  98.  
  99. /**
  100. * getCategory
  101. * @return mixed
  102. */
  103. public function getCategory()
  104. {
  105. return $this->category;
  106. }
  107.  
  108. /**
  109. * @return String empty
  110. */
  111. public function __toString(){
  112. return '';
  113. }
  114. }
Add Comment
Please, Sign In to add comment