<?php
declare(strict_types=1);
namespace App\Component\Product\Model;
use App\Component\Order\Model\OrderItem;
use App\Entity\User;
use App\Component\Core\Model\TimestampableTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
class Product implements ProductInterface
{
use TimestampableTrait;
/**
* @var string
*/
private $id;
/**
* @var int
*/
private $cart_cat;
/**
* @var int
*/
private $status;
/**
* @var int
*/
private $type;
/**
* @var int
*/
private $type1;
/**
* @var int
*/
private $user_id;
/**
* @var string
*/
private $name;
/**
* @var string
*/
private $name_en;
private $created_at;
/**
* @var
*/
private $image;
/**
* @var float
*/
private $price;
/**
* @var float
*/
private $price_old;
/**
* @var string
*
* @ORM\Column(type="text")
*/
private $content_en;
/**
* @var string
*
* @ORM\Column(type="text")
*/
private $content;
/**
* @var Collection
*/
private $orderItem;
public function __construct()
{
$this->orderItem = new ArrayCollection();
}
/**
* {@inheritdoc}
*/
public function getId(): ?string
{
return $this->id;
}
/**
* {@inheritdoc}
*/
public function getCart_cat(): int
{
return $this->cart_cat;
}
/**
* {@inheritdoc}
*/
public function setCart_cat(int $cart_cat): void
{
$this->cart_cat = $cart_cat;
}
/**
* {@inheritdoc}
*/
public function getUser_id(): int
{
return $this->user_id;
}
/**
* {@inheritdoc}
*/
public function setUser_id(int $user_id): void
{
$this->user_id = $user_id;
}
/**
* {@inheritdoc}
*/
public function getName(): string
{
return $this->name;
}
/**
* {@inheritdoc}
*/
public function setName(string $name): void
{
$this->name = $name;
}
/**
* {@inheritdoc}
*/
public function getNameEn(): string
{
return $this->name_en;
}
/**
* {@inheritdoc}
*/
public function setNameEn(string $name_en): void
{
$this->name_en = $name_en;
}
/**
* {@inheritdoc}
*/
public function getCreated_at()
{
return $this->created_at;
}
/**
* {@inheritdoc}
*/
public function setCreated_at(\DateTime $created_at): void
{
$this->created_at = $created_at;
}
/**
* {@inheritdoc}
*/
public function getContentEn(): string
{
return $this->content_en;
}
/**
* {@inheritdoc}
*/
public function setContentEn(string $content_en): void
{
$this->content_en = $content_en;
}
/**
* {@inheritdoc}
*/
public function getContent(): string
{
return $this->content;
}
/**
* {@inheritdoc}
*/
public function setContent(string $content): void
{
$this->content = $content;
}
/**
* {@inheritdoc}
*/
public function getImage(): string
{
return $this->image;
}
/**
* {@inheritdoc}
*/
public function getType(): int
{
return $this->type;
}
/**
* {@inheritdoc}
*/
public function setType(int $type): void
{
$this->type = $type;
}
/**
* {@inheritdoc}
*/
public function getType1(): int
{
return $this->type1;
}
/**
* {@inheritdoc}
*/
public function setType1(int $type1): void
{
$this->type1 = $type1;
}
/**
* {@inheritdoc}
*/
public function getStatus(): int
{
return $this->status;
}
/**
* {@inheritdoc}
*/
public function setStatus(int $status): void
{
$this->status = $status;
}
/**
* {@inheritdoc}
*/
public function setImage($image): void
{
$this->image = $image;
}
/**
* {@inheritdoc}
*/
public function getPrice(): float
{
return $this->price;
}
/**
* {@inheritdoc}
*/
public function setPrice(float $price): void
{
$this->price = $price;
}
/**
* {@inheritdoc}
*/
public function getPriceOld(): float
{
return $this->price_old;
}
/**
* {@inheritdoc}
*/
public function setPriceOld(float $price_old): void
{
$this->price_old = $price_old;
}
/**
* {@inheritdoc}
*/
public function getOrderItem(): Collection
{
return $this->orderItem;
}
public function addOrderItem(OrderItem $orderItem): self
{
if (!$this->orderItem->contains($orderItem)) {
$this->orderItem[] = $orderItem;
$orderItem->setProduct($this);
}
return $this;
}
public function removeOrderItem(OrderItem $orderItem): self
{
if ($this->orderItem->contains($orderItem)) {
$this->orderItem->removeElement($orderItem);
// set the owning side to null (unless already changed)
if ($orderItem->getProduct() === $this) {
$orderItem->setProduct(null);
}
}
return $this;
}
}