src/Component/Product/Model/Product.php line 13

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Component\Product\Model;
  4. use App\Component\Order\Model\OrderItem;
  5. use App\Entity\User;
  6. use App\Component\Core\Model\TimestampableTrait;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. class Product implements ProductInterface
  11. {
  12.     use TimestampableTrait;
  13.     /**
  14.      * @var string
  15.      */
  16.     private $id;
  17.     /**
  18.      * @var int
  19.      */
  20.     private $cart_cat;
  21.     /**
  22.      * @var int
  23.      */
  24.     private $status;
  25.     /**
  26.      * @var int
  27.      */
  28.     private $type;
  29.     /**
  30.      * @var int
  31.      */
  32.     private $type1;
  33.      /**
  34.      * @var int
  35.      */
  36.     private $user_id;
  37.     /**
  38.      * @var string
  39.      */
  40.     private $name;
  41.     /**
  42.      * @var string
  43.      */
  44.     private $name_en;
  45.     private $created_at;
  46.     /**
  47.      * @var
  48.      */
  49.     private $image;
  50.     /**
  51.      * @var float
  52.      */
  53.     private $price;
  54.     /**
  55.      * @var float
  56.      */
  57.     private $price_old;
  58.     /**
  59.      * @var string
  60.      *
  61.      * @ORM\Column(type="text")
  62.      */
  63.     private $content_en;
  64.     /**
  65.      * @var string
  66.      *
  67.      * @ORM\Column(type="text")
  68.      */
  69.     private $content;
  70.     /**
  71.      * @var Collection
  72.      */
  73.     private $orderItem;
  74.     public function __construct()
  75.     {
  76.         $this->orderItem = new ArrayCollection();
  77.     }
  78.     /**
  79.      * {@inheritdoc}
  80.      */
  81.     public function getId(): ?string
  82.     {
  83.         return $this->id;
  84.     }
  85.     /**
  86.      * {@inheritdoc}
  87.      */
  88.     public function getCart_cat(): int
  89.     {
  90.         return $this->cart_cat;
  91.     }
  92.     /**
  93.      * {@inheritdoc}
  94.      */
  95.     public function setCart_cat(int $cart_cat): void
  96.     {
  97.         $this->cart_cat $cart_cat;
  98.     }
  99.     /**
  100.      * {@inheritdoc}
  101.      */
  102.     public function getUser_id(): int
  103.     {
  104.         return $this->user_id;
  105.     }
  106.     /**
  107.      * {@inheritdoc}
  108.      */
  109.     public function setUser_id(int $user_id): void
  110.     {
  111.         $this->user_id $user_id;
  112.     }
  113.     /**
  114.      * {@inheritdoc}
  115.      */
  116.     public function getName(): string
  117.     {
  118.         return $this->name;
  119.     }
  120.     /**
  121.      * {@inheritdoc}
  122.      */
  123.     public function setName(string $name): void
  124.     {
  125.         $this->name $name;
  126.     }
  127.     /**
  128.      * {@inheritdoc}
  129.      */
  130.     public function getNameEn(): string
  131.     {
  132.         return $this->name_en;
  133.     }
  134.     /**
  135.      * {@inheritdoc}
  136.      */
  137.     public function setNameEn(string $name_en): void
  138.     {
  139.         $this->name_en $name_en;
  140.     }
  141.      /**
  142.      * {@inheritdoc}
  143.      */
  144.     public function getCreated_at()
  145.     {
  146.         return $this->created_at;
  147.     }
  148.     /**
  149.      * {@inheritdoc}
  150.      */
  151.     public function setCreated_at(\DateTime $created_at): void
  152.     {
  153.         $this->created_at $created_at;
  154.     }
  155.     
  156.     /**
  157.      * {@inheritdoc}
  158.      */
  159.     public function getContentEn(): string
  160.     {
  161.         return $this->content_en;
  162.     }
  163.     /**
  164.      * {@inheritdoc}
  165.      */
  166.     public function setContentEn(string $content_en): void
  167.     {
  168.         $this->content_en $content_en;
  169.     }
  170.   
  171.     /**
  172.      * {@inheritdoc}
  173.      */
  174.     public function getContent(): string
  175.     {
  176.         return $this->content;
  177.     }
  178.     /**
  179.      * {@inheritdoc}
  180.      */
  181.     public function setContent(string $content): void
  182.     {
  183.         $this->content $content;
  184.     }
  185.     /**
  186.      * {@inheritdoc}
  187.      */
  188.     public function getImage(): string
  189.     {
  190.         return $this->image;
  191.     }
  192.      /**
  193.      * {@inheritdoc}
  194.      */
  195.     public function getType(): int
  196.     {
  197.         return $this->type;
  198.     }
  199.     /**
  200.      * {@inheritdoc}
  201.      */
  202.     public function setType(int $type): void
  203.     {
  204.         $this->type $type;
  205.     }
  206.     /**
  207.      * {@inheritdoc}
  208.      */
  209.     public function getType1(): int
  210.     {
  211.         return $this->type1;
  212.     }
  213.     /**
  214.      * {@inheritdoc}
  215.      */
  216.     public function setType1(int $type1): void
  217.     {
  218.         $this->type1 $type1;
  219.     }
  220.      /**
  221.      * {@inheritdoc}
  222.      */
  223.     public function getStatus(): int
  224.     {
  225.         return $this->status;
  226.     }
  227.     /**
  228.      * {@inheritdoc}
  229.      */
  230.     public function setStatus(int $status): void
  231.     {
  232.         $this->status $status;
  233.     }
  234.     /**
  235.      * {@inheritdoc}
  236.      */
  237.     public function setImage($image): void
  238.     {
  239.         $this->image $image;
  240.     }
  241.     /**
  242.      * {@inheritdoc}
  243.      */
  244.     public function getPrice(): float
  245.     {
  246.         return $this->price;
  247.     }
  248.     /**
  249.      * {@inheritdoc}
  250.      */
  251.     public function setPrice(float $price): void
  252.     {
  253.         $this->price $price;
  254.     }
  255.     
  256.     /**
  257.      * {@inheritdoc}
  258.      */
  259.     public function getPriceOld(): float
  260.     {
  261.         return $this->price_old;
  262.     }
  263.     /**
  264.      * {@inheritdoc}
  265.      */
  266.     public function setPriceOld(float $price_old): void
  267.     {
  268.         $this->price_old $price_old;
  269.     }
  270.     /**
  271.      * {@inheritdoc}
  272.      */
  273.     public function getOrderItem(): Collection
  274.     {
  275.         return $this->orderItem;
  276.     }
  277.     public function addOrderItem(OrderItem $orderItem): self
  278.     {
  279.         if (!$this->orderItem->contains($orderItem)) {
  280.             $this->orderItem[] = $orderItem;
  281.             $orderItem->setProduct($this);
  282.         }
  283.         return $this;
  284.     }
  285.     public function removeOrderItem(OrderItem $orderItem): self
  286.     {
  287.         if ($this->orderItem->contains($orderItem)) {
  288.             $this->orderItem->removeElement($orderItem);
  289.             // set the owning side to null (unless already changed)
  290.             if ($orderItem->getProduct() === $this) {
  291.                 $orderItem->setProduct(null);
  292.             }
  293.         }
  294.         return $this;
  295.     }
  296. }