<?php
namespace App\Entity;
use App\Entity\OrderService;
use App\Entity\Product\Product;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\ExclusionPolicy;
use JMS\Serializer\Annotation\Expose;
/**
* Class Order Item
*
* @ORM\Entity(repositoryClass="App\Repository\OrderItemRepository")
* @ORM\Table(name="malys_order_item")
* @ORM\HasLifecycleCallbacks()
* @ExclusionPolicy("all")
*/
class OrderItem
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @Expose
*/
protected $id;
/**
* @var Order
*
* @ORM\ManyToOne(targetEntity="Order", inversedBy="items")
* @ORM\JoinColumn(name="order_id", referencedColumnName="id")
*/
protected $order;
/**
* @var ArrayCollection
*
* @ORM\OneToMany(targetEntity="OrderItemService", mappedBy="orderItem", cascade={"persist", "remove"})
*/
protected $services;
/**
* @var integer
*
* @ORM\Column(name="quantity", type="integer", nullable=false)
* @Expose
*/
protected $quantity = 1;
/**
* @var float
*
* @ORM\Column(name="unit_price_excluding_tax", type="float", nullable=true)
*/
protected $unitPriceExcludingTax;
/**
* @var float
*
* @ORM\Column(name="promotion", type="float", nullable=true)
*/
protected $promotion;
/**
* @var string
*
* @ORM\Column(name="promotion_type", type="string", nullable=true)
*/
protected $promotionType;
/**
* @var string
* @ORM\Column(name="promotion_label", type="string", nullable=true)
*/
protected $promotionLabel;
/**
* @var float
*
* @ORM\Column(name="total_price_excluding_tax", type="float", nullable=false)
* @Expose
*/
protected $totalPriceExcludingTax;
/**
* @var float
*
* @ORM\Column(name="total_saving_excluding_tax", type="float", nullable=true)
* @Expose
*/
protected $totalSavingExcludingTax;
/**
* @var Product
*
* @ORM\ManyToOne(targetEntity="App\Entity\Product\Product")
* @ORM\JoinColumn(name="product_id", referencedColumnName="id", onDelete="SET NULL")
*/
protected $product;
/**
* @var string
*
* @ORM\Column(name="product_id_copy", type="integer", nullable=true)
*/
protected $productIdCopy;
/**
* @var string
*
* @ORM\Column(name="product_type", type="string", nullable=true)
*/
protected $productType;
/**
* @var string
*
* @ORM\Column(name="product_code", type="string", length=255, nullable=true)
* @Expose
*/
protected $productCode;
/**
* @var string
*
* @ORM\Column(name="product_name", type="string", length=255, nullable=false)
* @Expose
*/
protected $productName;
/**
* @var string
*
* @ORM\Column(name="product_category_label", type="string", length=255, nullable=true)
*/
protected $productCategoryLabel;
/**
* @var string
*
* @ORM\Column(name="product_sales_unit", type="string", length=255, nullable=true)
*/
protected $productSalesUnit;
/**
* @var string
*
* @ORM\Column(name="product_weight", type="string", nullable=true)
*/
protected $productWeight;
/**
* @var string
*
* @ORM\Column(name="product_packaging", type="string", nullable=true)
*/
protected $productPackaging;
/**
* @var string
*
* @ORM\Column(name="product_size", type="string", nullable=true)
*/
protected $productSize;
/**
* @var string
*
* @ORM\Column(name="product_picture", type="string", nullable=true)
*/
protected $productPicture;
/**
* @var string
*
* @ORM\Column(name="product_fsa", type="string", length=255, nullable=true)
*/
protected $productFsa;
/**
* @var boolean
*
* @ORM\Column(name="product_bio", type="boolean", options={"default" : false}, nullable=true)
*/
protected $productBio = false;
/**
* @var boolean
*
* @ORM\Column(name="product_locavore", type="boolean", options={"default" : false}, nullable=true)
*/
protected $productLocavore = false;
/**
* @var DateTime
*
* @ORM\Column(name="product_dluo", type="integer", nullable=true)
*/
protected $productDluo;
/**
* @var string
*
* @ORM\Column(name="product_preparation", type="text", nullable=true)
*/
protected $productPreparation;
/**
* @var string
*
* @ORM\Column(name="product_description", type="text", nullable=true)
*/
protected $productDescription;
/**
* @var string
*
* @ORM\Column(name="product_label", type="string", nullable=true)
*/
protected $productLabel;
/**
* @var string
*
* @ORM\Column(name="product_grower", type="string", nullable=true)
*/
protected $productGrower;
/**
* @var string
*
* @ORM\Column(name="product_origin", type="string", nullable=true)
*/
protected $productOrigin;
/**
* @var string
*
* @ORM\Column(name="more_products", type="string", nullable=true)
*/
protected $moreProducts;
/**
* @var string
*
* @ORM\Column(name="product_brand", type="string", nullable=true)
*/
protected $productBrand;
/**
* @var DateTime
*
* @ORM\Column(name="created_at", type="datetime", nullable=false)
*/
protected $createdAt;
/**
* @var DateTime
*
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
*/
protected $updatedAt;
/**
* @var float $bundling
* @ORM\Column(name="bundling", type="float", nullable=true)
*/
protected $bundling;
/**
* @var string
* @ORM\Column(name="product_promotion_type", type="string", nullable=true)
*/
protected $productPromotionType;
/**
* @var string
* @ORM\Column(name="product_order_unit_singular_label", type="string", nullable=true)
*/
protected $productOrderUnitSingularLabel;
/**
* @var string
* @ORM\Column(name="product_order_unit_plural_label", type="string", nullable=true)
*/
protected $productOrderUnitPluralLabel;
/*** PRODUCT VARIATION FIELD ***/
/**
*
* @ORM\ManyToOne(targetEntity="ProductVariation")
* @ORM\JoinColumn(name="product_variation_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
*/
protected $productVariation;
/**
*
* @ORM\Column(name="product_variation_id_copy", type="integer", nullable=true)
*/
protected $productVariationIdCopy;
/**
* @ORM\Column(name="product_variation_invoice_unit_count", type="float", nullable=true)
*/
protected $productVariationInvoiceUnitCount;
/**
* @ORM\Column(name="product_variation_label", type="string", nullable=true)
* @Expose
*/
protected $productVariationLabel;
/**
*
* @ORM\ManyToOne(targetEntity="Unit")
* @ORM\JoinColumn(name="product_variation_order_unit", referencedColumnName="id", nullable=true)
*/
protected $productVariationOrderUnit;
/**
* @ORM\Column(name="product_variation_order_unit_singular", type="string", nullable=true)
*/
protected $productVariationOrderUnitSingular;
/**
* @ORM\Column(name="product_variation_order_unit_plural", type="string", nullable=true)
*/
protected $productVariationOrderUnitPlural;
/**
* @ORM\Column(name="product_tags_ids", type="array", nullable=true)
*/
protected $productTagsIds;
/**
* @ORM\Column(name="product_tags_names", type="array", nullable=true)
*/
protected $productTagsNames;
/**
* @ORM\Column(name="product_featurings_ids", type="array", nullable=true)
*/
protected $productFeaturingsIds;
/**
* @ORM\Column(name="product_featurings_tiles", type="array", nullable=true)
*/
protected $productFeaturingsTitles;
/**
* @ORM\Column(name="bought_by_customer_occurence", type="integer", nullable=true)
*/
protected $boughtByCustomerOccurence;
// For ES extra field
protected $topCategoryId;
/**
* OrderItem constructor.
*/
public function __construct()
{
$this->services = new ArrayCollection();
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return Order
*/
public function getOrder()
{
return $this->order;
}
/**
* @param Order $order
*/
public function setOrder($order)
{
$this->order = $order;
}
/**
* @param Product $product
*/
public function setProduct($product)
{
$this->product = $product;
}
/**
* @return int
*/
public function getQuantity()
{
return $this->quantity;
}
/**
* @param int $quantity
*/
public function setQuantity($quantity)
{
$this->quantity = $quantity;
}
/**
* @return float
*/
public function getUnitPriceExcludingTax()
{
return $this->unitPriceExcludingTax;
}
/**
* @param float $unitPriceExcludingTax
*/
public function setUnitPriceExcludingTax($unitPriceExcludingTax)
{
$this->unitPriceExcludingTax = $unitPriceExcludingTax;
}
/**
* @return float
*/
public function getPromotion()
{
return $this->promotion;
}
/**
* @param float $promotion
*/
public function setPromotion($promotion)
{
$this->promotion = $promotion;
}
/**
* @return string
*/
public function getPromotionType()
{
return $this->promotionType;
}
/**
* @param string $promotionType
*/
public function setPromotionType($promotionType)
{
$this->promotionType = $promotionType;
}
/**
* @return float
*/
public function getTotalPriceExcludingTax()
{
return $this->totalPriceExcludingTax;
}
/**
* @param float $totalPriceExcludingTax
*/
public function setTotalPriceExcludingTax($totalPriceExcludingTax)
{
$this->totalPriceExcludingTax = $totalPriceExcludingTax;
}
/**
* @return Product
*/
public function getProduct()
{
return $this->product;
}
/**
* @return string
*/
public function getProductCode()
{
return $this->productCode;
}
/**
* @param string $productCode
*/
public function setProductCode($productCode)
{
$this->productCode = $productCode;
}
/**
* @return string
*/
public function getProductName()
{
return $this->productName;
}
/**
* @param string $productName
*/
public function setProductName($productName)
{
$this->productName = $productName;
}
/**
* @return string
*/
public function getProductCategoryLabel()
{
return $this->productCategoryLabel;
}
/**
* @param string $productCategoryLabel
*/
public function setProductCategoryLabel($productCategoryLabel)
{
$this->productCategoryLabel = $productCategoryLabel;
}
/**
* @return string
*/
public function getProductSalesUnit()
{
return $this->productSalesUnit;
}
/**
* @param string $productSalesUnit
*/
public function setProductSalesUnit($productSalesUnit)
{
$this->productSalesUnit = $productSalesUnit;
}
/**
* @return string
*/
public function getProductWeight()
{
return $this->productWeight;
}
/**
* @param string $productWeight
*/
public function setProductWeight($productWeight)
{
$this->productWeight = $productWeight;
}
/**
* @return string
*/
public function getProductPackaging()
{
return $this->productPackaging;
}
/**
* @param string $productPackaging
*/
public function setProductPackaging($productPackaging)
{
$this->productPackaging = $productPackaging;
}
/**
* @return string
*/
public function getProductSize()
{
return $this->productSize;
}
/**
* @param string $productSize
*/
public function setProductSize($productSize)
{
$this->productSize = $productSize;
}
/**
* @return string
*/
public function getProductPicture()
{
return $this->productPicture;
}
/**
* @param string $productPicture
*/
public function setProductPicture($productPicture)
{
$this->productPicture = $productPicture;
}
/**
* @return string
*/
public function getProductFsa()
{
return $this->productFsa;
}
/**
* @param string $productFsa
*/
public function setProductFsa($productFsa)
{
$this->productFsa = $productFsa;
}
/**
* @return bool
*/
public function isProductBio()
{
return $this->productBio;
}
/**
* @param bool $productBio
*/
public function setProductBio($productBio)
{
$this->productBio = $productBio;
}
/**
* @return bool
*/
public function isProductLocavore()
{
return $this->productLocavore;
}
/**
* @param bool $productLocavore
*/
public function setProductLocavore($productLocavore)
{
$this->productLocavore = $productLocavore;
}
/**
* @return DateTime
*/
public function getProductDluo()
{
return $this->productDluo;
}
/**
* @param DateTime $productDluo
*/
public function setProductDluo($productDluo)
{
$this->productDluo = $productDluo;
}
/**
* @return string
*/
public function getProductDescription()
{
return $this->productDescription;
}
/**
* @param string $productDescription
*/
public function setProductDescription($productDescription)
{
$this->productDescription = $productDescription;
}
/**
* @return string
*/
public function getProductLabel()
{
return $this->productLabel;
}
/**
* @param string $productLabel
*/
public function setProductLabel($productLabel)
{
$this->productLabel = $productLabel;
}
/**
* @return string
*/
public function getProductGrower()
{
return $this->productGrower;
}
/**
* @param string $productGrower
*/
public function setProductGrower($productGrower)
{
$this->productGrower = $productGrower;
}
/**
* @return string
*/
public function getProductOrigin()
{
return $this->productOrigin;
}
/**
* @param string $productOrigin
*/
public function setProductOrigin($productOrigin)
{
$this->productOrigin = $productOrigin;
}
/**
* @return string
*/
public function getMoreProducts()
{
return $this->moreProducts;
}
/**
* @param string $moreProducts
*/
public function setMoreProducts($moreProducts)
{
$this->moreProducts = $moreProducts;
}
/**
* @return string
*/
public function getProductBrand()
{
return $this->productBrand;
}
/**
* @param string $productBrand
*/
public function setProductBrand($productBrand)
{
$this->productBrand = $productBrand;
}
/**
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set createdAt
*
* @return OrderItem
* @ORM\PrePersist
*/
public function setCreatedAt()
{
$this->createdAt = new DateTime();
$this->updatedAt = new DateTime();
return $this;
}
/**
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set updatedAt
*
* @return OrderItem
* @ORM\PreUpdate
*/
public function setUpdatedAt()
{
$this->updatedAt = new DateTime();
return $this;
}
/**
* @return float
*/
public function getBundling()
{
return $this->bundling;
}
/**
* @param float $bundling
*/
public function setBundling($bundling)
{
$this->bundling = $bundling;
}
/**
* @return string
*/
public function getProductPromotionType()
{
return $this->productPromotionType;
}
/**
* @param string $productPromotionType
*/
public function setProductPromotionType($productPromotionType)
{
$this->productPromotionType = $productPromotionType;
}
/**
* @return string
*/
public function getPromotionLabel()
{
return $this->promotionLabel;
}
/**
* @param string $promotionLabel
*/
public function setPromotionLabel($promotionLabel)
{
$this->promotionLabel = $promotionLabel;
}
/**
* @return string
*/
public function getProductOrderUnitSingularLabel()
{
return $this->productOrderUnitSingularLabel;
}
/**
* @param string $productOrderUnitSingularLabel
*/
public function setProductOrderUnitSingularLabel($productOrderUnitSingularLabel)
{
$this->productOrderUnitSingularLabel = $productOrderUnitSingularLabel;
}
/**
* @return string
*/
public function getProductOrderUnitPluralLabel()
{
return $this->productOrderUnitPluralLabel;
}
/**
* @param string $productOrderUnitPluralLabel
*/
public function setProductOrderUnitPluralLabel($productOrderUnitPluralLabel)
{
$this->productOrderUnitPluralLabel = $productOrderUnitPluralLabel;
}
/**
* @return mixed
*/
public function getProductVariation()
{
return $this->productVariation;
}
/**
* @param mixed $productVariation
*/
public function setProductVariation($productVariation)
{
$this->productVariation = $productVariation;
}
/**
* @return mixed
*/
public function getProductVariationInvoiceUnitCount()
{
return $this->productVariationInvoiceUnitCount;
}
/**
* @param mixed $productVariationInvoiceUnitCount
*/
public function setProductVariationInvoiceUnitCount($productVariationInvoiceUnitCount)
{
$this->productVariationInvoiceUnitCount = $productVariationInvoiceUnitCount;
}
/**
* @return mixed
*/
public function getProductVariationLabel()
{
return $this->productVariationLabel;
}
/**
* @param mixed $productVariationLabel
*/
public function setProductVariationLabel($productVariationLabel)
{
$this->productVariationLabel = $productVariationLabel;
}
/**
* @return mixed
*/
public function getProductVariationOrderUnit()
{
return $this->productVariationOrderUnit;
}
/**
* @param mixed $productVariationOrderUnit
*/
public function setProductVariationOrderUnit($productVariationOrderUnit)
{
$this->productVariationOrderUnit = $productVariationOrderUnit;
}
/**
* @return mixed
*/
public function getProductVariationOrderUnitSingular()
{
return $this->productVariationOrderUnitSingular;
}
/**
* @param mixed $productVariationOrderUnitSingular
*/
public function setProductVariationOrderUnitSingular($productVariationOrderUnitSingular)
{
$this->productVariationOrderUnitSingular = $productVariationOrderUnitSingular;
}
/**
* @return mixed
*/
public function getProductVariationOrderUnitPlural()
{
return $this->productVariationOrderUnitPlural;
}
/**
* @param mixed $productVariationOrderUnitPlural
*/
public function setProductVariationOrderUnitPlural($productVariationOrderUnitPlural)
{
$this->productVariationOrderUnitPlural = $productVariationOrderUnitPlural;
}
/**
* @return string
*/
public function getProductIdCopy()
{
return $this->productIdCopy;
}
/**
* @param string $productIdCopy
*/
public function setProductIdCopy($productIdCopy)
{
$this->productIdCopy = $productIdCopy;
}
/**
* @return mixed
*/
public function getProductVariationIdCopy()
{
return $this->productVariationIdCopy;
}
/**
* @param mixed $productVariationIdCopy
*/
public function setProductVariationIdCopy($productVariationIdCopy)
{
$this->productVariationIdCopy = $productVariationIdCopy;
}
/**
* @return ArrayCollection
*/
public function getServices()
{
return $this->services;
}
/**
* @param ArrayCollection $services
*/
public function setServices($services)
{
$this->services = $services;
}
public function addService($service)
{
$service->setOrderItem($this);
$this->services->add($service);
}
/**
* @param OrderService $service
*/
public function removeService($service)
{
if ($this->services->contains($service)) {
$this->services->removeElement($service);
}
}
/**
* @return float
*/
public function getTotalSavingExcludingTax()
{
return $this->totalSavingExcludingTax;
}
/**
* @param float $totalSavingExcludingTax
*/
public function setTotalSavingExcludingTax($totalSavingExcludingTax)
{
$this->totalSavingExcludingTax = $totalSavingExcludingTax;
}
/**
* @return mixed
*/
public function getTopCategoryId()
{
return $this->topCategoryId;
}
/**
* @param mixed $topCategoryId
*/
public function setTopCategoryId($topCategoryId)
{
$this->topCategoryId = $topCategoryId;
}
/**
* @return string
*/
public function getProductPreparation(): string
{
return $this->productPreparation;
}
/**
* @param string $productPreparation
*/
public function setProductPreparation($productPreparation)
{
$this->productPreparation = $productPreparation;
}
/**
* @return mixed
*/
public function getProductTagsIds()
{
return $this->productTagsIds;
}
/**
* @param mixed $productTagsIds
*/
public function setProductTagsIds($productTagsIds)
{
$this->productTagsIds = $productTagsIds;
}
/**
* @return mixed
*/
public function getProductFeaturingsIds()
{
return $this->productFeaturingsIds;
}
/**
* @param mixed $productFeaturingsIds
*/
public function setProductFeaturingsIds($productFeaturingsIds)
{
$this->productFeaturingsIds = $productFeaturingsIds;
}
/**
* @return mixed
*/
public function getProductTagsNames()
{
return $this->productTagsNames;
}
/**
* @param mixed $productTagsNames
*/
public function setProductTagsNames($productTagsNames)
{
$this->productTagsNames = $productTagsNames;
}
/**
* @return mixed
*/
public function getProductFeaturingsTitles()
{
return $this->productFeaturingsTitles;
}
/**
* @param mixed $productFeaturingsTitles
*/
public function setProductFeaturingsTitles($productFeaturingsTitles)
{
$this->productFeaturingsTitles = $productFeaturingsTitles;
}
/**
* @return mixed
*/
public function getBoughtByCustomerOccurence()
{
return $this->boughtByCustomerOccurence;
}
/**
* @param mixed $boughtByCustomerOccurence
*/
public function setBoughtByCustomerOccurence($boughtByCustomerOccurence)
{
$this->boughtByCustomerOccurence = $boughtByCustomerOccurence;
}
/**
* @return string
*/
public function getProductType(): string
{
return $this->productType;
}
/**
* @param string $productType
*/
public function setProductType(string $productType): void
{
$this->productType = $productType;
}
}