src/Entity/System/CoreUrlRewrite.php line 27

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