<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Manufacturers
*
* @ORM\Table(name="redirections")
* @ORM\Entity(repositoryClass="App\Repository\RedirectionRepository")
*/
class Redirection
{
/**
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var App\Entity\Product|null
*
* @ORM\ManyToOne(targetEntity="App\Entity\Product")
* @ORM\JoinColumn(name="redirect_product_id", referencedColumnName="products_id", nullable=true, onDelete="CASCADE")
*/
private $fromProduct;
/**
* @var App\Entity\Category|null
*
* @ORM\ManyToOne(targetEntity="App\Entity\Category")
* @ORM\JoinColumn(name="redirect_category_id", referencedColumnName="categories_id", nullable=true, onDelete="CASCADE")
*/
private $fromCategory;
/**
* @var App\Entity\Category|null
*
* @ORM\Column(name="redirect_url", type="string", length=255, nullable=true)
*/
private $fromUrl;
/**
* @ORM\Column(name="target_path", type="string", length=255, nullable=true)
*/
private $targetPath;
/**
* @var App\Entity\Product|null
*
* @ORM\ManyToOne(targetEntity="App\Entity\Product")
* @ORM\JoinColumn(name="target_product_id", referencedColumnName="products_id", nullable=true, onDelete="CASCADE")
*/
private $toProduct;
/**
*
* @ORM\ManyToOne(targetEntity="App\Entity\Category")
* @ORM\JoinColumn(name="target_category_id", referencedColumnName="categories_id", nullable=true, onDelete="CASCADE")
*/
private $toCategory;
/**
* @ORM\Column(name="target_url", type="string", length=255, nullable=true)
*/
private $toUrl;
public function getId() {
return $this->id;
}
public function getFromProduct() {
return $this->fromProduct;
}
public function getFromCategory() {
return $this->fromCategory;
}
public function getFromUrl() {
return $this->fromUrl;
}
public function getTargetPath(){
return $this->targetPath;
}
public function getToProduct() {
return $this->toProduct;
}
public function getToCategory() {
return $this->toCategory;
}
public function getToUrl() {
return $this->toUrl;
}
public function setFromProduct($fromProduct) {
$this->fromProduct = $fromProduct;
}
public function setFromCategory($fromCategory) {
$this->fromCategory = $fromCategory;
}
public function setFromUrl($fromUrl) {
$this->fromUrl = $fromUrl;
}
public function setTargetPath($targetPath) {
$this->targetPath = $targetPath;
}
public function setToProduct($toProduct) {
$this->toProduct = $toProduct;
}
public function setToCategory($toCategory) {
$this->toCategory = $toCategory;
}
public function setToUrl($toUrl) {
$this->toUrl = $toUrl;
}
public function toArray() : array{
$output = [
'id' => $this->getId(),
'fromProduct' => $this->getFromProduct()?$this->getFromProduct()->toArray():null,
'fromCategory' => $this->getFromCategory()?$this->getFromCategory()->toArray():null,
'fromUrl' => $this->getFromUrl(),
'targetPath' => $this->getTargetPath(),
'toProduct' => $this->getToProduct()?$this->getToProduct()->toArray():null,
'toCategory' => $this->getToCategory()?$this->getToCategory()->toArray():null,
'toUrl' => $this->getToUrl(),
];
return $output;
}
}