src/Entity/System/CoreUrlRewrite.php line 24

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