<?php
namespace App\Entity\ECommerce;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as JMS;
use App\Entity\ECommerce\Traits\DatesInterface;
use App\Entity\ECommerce\Traits\DatesTrait;
use App\Entity\ECommerce\Traits\RemoteInterface;
use App\Entity\ECommerce\Traits\RemoteTrait;
/**
* ProductManufacturer
*
* @ORM\Table(name="product_manufacturer")
* @ORM\Entity(repositoryClass="App\Repository\ECommerce\ProductManufacturerRepository")
* @ORM\Cache(usage="READ_ONLY", region="public")
*/
class ProductManufacturer implements DatesInterface, RemoteInterface, \Stringable
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=40, unique=true)
*
* @JMS\Groups({"depot_products", "depot_product_private", "cart_private", "view_product"})
*/
private $name;
/**
* @var int
*
* @ORM\Column(name="sorting_priority", type="integer", length=2, options={"default"=0})
*/
private $sortingPriority=0;
/**
* @var Collection
*
* @ORM\ManyToMany(targetEntity="App\Entity\ECommerce\ProductInfo", mappedBy="manufacturers")
*/
private $codes;
/**
* @ORM\OneToMany(targetEntity="App\Entity\ECommerce\Product", mappedBy="manufacturer")
*/
private \Doctrine\Common\Collections\Collection $products;
use DatesTrait {
DatesTrait::__construct as __D_construct;
}
use RemoteTrait;
/**
* Constructor
*/
public function __construct()
{
$this->codes = new ArrayCollection();
$this->__D_construct();
}
function __toString(): string
{
return $this->name;
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*/
public function setName($name): static
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set sortingPriority
*
* @param integer $sortingPriority
*/
public function setSortingPriority($sortingPriority): static
{
$this->sortingPriority = $sortingPriority;
return $this;
}
/**
* Get sortingPriority
*
* @return integer
*/
public function getSortingPriority()
{
return $this->sortingPriority;
}
/**
* Add code
*
*
*/
public function addCode(ProductInfo $code): static
{
$this->codes[] = $code;
return $this;
}
/**
* Remove code
*/
public function removeCode(ProductInfo $code): void
{
$this->codes->removeElement($code);
}
/**
* Get codes
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getCodes()
{
return $this->codes;
}
public function getProducts(): Collection
{
return $this->products;
}
public function setProducts(Collection $products): void
{
$this->products = $products;
}
}