src/Entity/System/CoreUrlRewrite.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * CoreUrlRewrite
  7. *
  8. * @ORM\Table(name="core_url_rewrite",
  9. * indexes={
  10. *
  11. * @ORM\Index(name="request_path", columns={"request_path"}),
  12. * @ORM\Index(name="IDX_CMS", columns={"cms_id"}),
  13. * @ORM\Index(name="IDX_CORE_URL_REWRITE_TARGET_PATH", columns={"target_path"})
  14. * })
  15. *
  16. * @ORM\Entity(repositoryClass="App\Repository\System\CoreUrlRewriteRepository")
  17. */
  18. class CoreUrlRewrite
  19. {
  20. public const TARGET_PATH_PRODUCT = 'product/view/';
  21. public const TARGET_PATH_MANUFACTURER = 'manufacturer/view/';
  22. public const TARGET_PATH_TAXONOMY = 'taxonomy/view/';
  23. /**
  24. * @var int
  25. *
  26. * @ORM\Column(name="url_rewrite_id", type="integer")
  27. *
  28. * @ORM\Id
  29. *
  30. * @ORM\GeneratedValue(strategy="AUTO")
  31. */
  32. private $id;
  33. /**
  34. * @var string
  35. *
  36. * @ORM\Column(name="request_path", type="string", length=255, nullable=true)
  37. */
  38. private $requestPath;
  39. /**
  40. * @var string
  41. *
  42. * @ORM\Column(name="target_path", type="string", length=255, nullable=true)
  43. */
  44. private $targetPath;
  45. /**
  46. * @var Product|null
  47. *
  48. * @ORM\ManyToOne(targetEntity="App\Entity\System\Product", inversedBy="coreUrlRewrites")
  49. *
  50. * @ORM\JoinColumn(name="product_id", nullable=true, referencedColumnName="id_product")
  51. */
  52. private $product;
  53. /**
  54. * @var Language|null
  55. *
  56. * @ORM\ManyToOne(targetEntity="App\Entity\System\Language")
  57. *
  58. * @ORM\JoinColumn(name="id_lang", nullable=true, referencedColumnName="id_lang")
  59. */
  60. private $language;
  61. /**
  62. * @var CoreUrlRewrite|null
  63. *
  64. * @ORM\ManyToOne(targetEntity="App\Entity\System\CoreUrlRewrite", inversedBy="redirectedFrom")
  65. *
  66. * @ORM\JoinColumn(nullable=true, name="id_core_url_rewrite_redirect", referencedColumnName="url_rewrite_id")
  67. */
  68. private $redirectsTo;
  69. /**
  70. * @var CoreUrlRewrite[]|ArrayCollection
  71. *
  72. * @ORM\OneToMany(targetEntity="App\Entity\System\CoreUrlRewrite", mappedBy="redirectsTo")
  73. */
  74. private $redirectedFrom;
  75. /**
  76. * @var Category|null
  77. *
  78. * @ORM\ManyToOne(targetEntity="App\Entity\System\Category")
  79. *
  80. * @ORM\JoinColumn(name="category_id", nullable=true, referencedColumnName="id_category")
  81. */
  82. private $category;
  83. /**
  84. * @var Taxonomy|null
  85. *
  86. * @ORM\ManyToOne(targetEntity="App\Entity\System\Taxonomy")
  87. *
  88. * @ORM\JoinColumn(name="taxonomy_id", nullable=true, referencedColumnName="id")
  89. */
  90. private $taxonomy;
  91. /**
  92. * @var Cms|null
  93. *
  94. * @ORM\ManyToOne(targetEntity="App\Entity\System\Cms")
  95. *
  96. * @ORM\JoinColumn(name="cms_id", nullable=true, referencedColumnName="id_cms")
  97. */
  98. private $cms;
  99. /**
  100. * @return int
  101. */
  102. public function getId(): int
  103. {
  104. return $this->id;
  105. }
  106. /**
  107. * @return string
  108. */
  109. public function getRequestPath(): string
  110. {
  111. return $this->requestPath;
  112. }
  113. /**
  114. * @param string $requestPath
  115. *
  116. * @return CoreUrlRewrite
  117. */
  118. public function setRequestPath(string $requestPath): CoreUrlRewrite
  119. {
  120. $this->requestPath = $requestPath;
  121. return $this;
  122. }
  123. /**
  124. * @return string
  125. */
  126. public function getTargetPath(): string
  127. {
  128. return $this->targetPath;
  129. }
  130. /**
  131. * @param string $targetPath
  132. *
  133. * @return CoreUrlRewrite
  134. */
  135. public function setTargetPath(string $targetPath): CoreUrlRewrite
  136. {
  137. $this->targetPath = $targetPath;
  138. return $this;
  139. }
  140. /**
  141. * @return Product|null
  142. */
  143. public function getProduct(): ?Product
  144. {
  145. return $this->product;
  146. }
  147. /**
  148. * @param Product|null $product
  149. *
  150. * @return CoreUrlRewrite
  151. */
  152. public function setProduct(?Product $product): CoreUrlRewrite
  153. {
  154. $this->product = $product;
  155. return $this;
  156. }
  157. /**
  158. * @return Language|null
  159. */
  160. public function getLanguage(): ?Language
  161. {
  162. return $this->language;
  163. }
  164. /**
  165. * @param Language|null $language
  166. *
  167. * @return CoreUrlRewrite
  168. */
  169. public function setLanguage(?Language $language): CoreUrlRewrite
  170. {
  171. $this->language = $language;
  172. return $this;
  173. }
  174. /**
  175. * @return CoreUrlRewrite|null
  176. */
  177. public function getRedirectsTo(): ?CoreUrlRewrite
  178. {
  179. return $this->redirectsTo;
  180. }
  181. /**
  182. * @param CoreUrlRewrite|null $redirectsTo
  183. *
  184. * @return CoreUrlRewrite
  185. */
  186. public function setRedirectsTo(?CoreUrlRewrite $redirectsTo): CoreUrlRewrite
  187. {
  188. $this->redirectsTo = $redirectsTo;
  189. return $this;
  190. }
  191. /**
  192. * @return CoreUrlRewrite[]|ArrayCollection
  193. */
  194. public function getRedirectedFrom()
  195. {
  196. return $this->redirectedFrom;
  197. }
  198. /**
  199. * @param CoreUrlRewrite[]|ArrayCollection $redirectedFrom
  200. *
  201. * @return CoreUrlRewrite
  202. */
  203. public function setRedirectedFrom($redirectedFrom): CoreUrlRewrite
  204. {
  205. $this->redirectedFrom = $redirectedFrom;
  206. return $this;
  207. }
  208. /**
  209. * @return Category|null
  210. */
  211. public function getCategory(): ?Category
  212. {
  213. return $this->category;
  214. }
  215. /**
  216. * @param Category|null $category
  217. *
  218. * @return CoreUrlRewrite
  219. */
  220. public function setCategory(?Category $category): CoreUrlRewrite
  221. {
  222. $this->category = $category;
  223. return $this;
  224. }
  225. /**
  226. * @return Taxonomy|null
  227. */
  228. public function getTaxonomy(): ?Taxonomy
  229. {
  230. return $this->taxonomy;
  231. }
  232. /**
  233. * @param Taxonomy|null $taxonomy
  234. *
  235. * @return CoreUrlRewrite
  236. */
  237. public function setTaxonomy(?Taxonomy $taxonomy): CoreUrlRewrite
  238. {
  239. $this->taxonomy = $taxonomy;
  240. return $this;
  241. }
  242. public function __construct()
  243. {
  244. $this->redirectedFrom = new ArrayCollection();
  245. }
  246. public function getCms(): ?Cms
  247. {
  248. return $this->cms;
  249. }
  250. public function setCms(?Cms $cms): CoreUrlRewrite
  251. {
  252. $this->cms = $cms;
  253. return $this;
  254. }
  255. }