<?php
namespace App\Entity\System;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* Class CodeDiscount
*
* @ORM\Table(name="code_discount")
*
* @ORM\Entity(repositoryClass="App\Repository\System\CodeDiscountRepository")
*/
class CodeDiscount
{
/**
* @ORM\Id()
*
* @ORM\GeneratedValue()
*
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var string
*
* @ORM\Column (type="string", length=30)
*/
private $code;
/**
* @var bool
*
* @ORM\Column (type="boolean")
*/
private $active;
/**
* @var Customer|null
*
* @ORM\ManyToOne(targetEntity="App\Entity\System\Customer", inversedBy="customerApi")
*
* @ORM\JoinColumn(name="customer", referencedColumnName="id_customer")
*/
private $customer;
/**
* @var float
*
* @ORM\Column(type="decimal", precision=20, scale=6, options={"default" : 0.000000})
*/
private $discount;
/**
* @var \DateTime|null
*
* @ORM\Column(type="datetime")
*/
private $dateExpiration;
/**
* @var \DateTime|null
*
* @ORM\Column(type="datetime")
*/
private $dateStarting;
/**
* @var Order[]|ArrayCollection
*
* @ORM\ManyToMany(targetEntity="App\Entity\System\Order", mappedBy="codeDiscount")
*/
private $orders;
/**
* @var int|null
*
* @ORM\Column (type="integer")
*/
private $type;
public function __construct()
{
$this->orders = new ArrayCollection();
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getCode(): string
{
return $this->code;
}
/**
* @return bool
*/
public function isActive(): bool
{
return $this->active;
}
/**
* @return Customer|null
*/
public function getCustomer(): ?Customer
{
return $this->customer;
}
/**
* @return float
*/
public function getDiscount(): float
{
return $this->discount;
}
/**
* @return \DateTime|null
*/
public function getDateExpiration(): ?\DateTime
{
return $this->dateExpiration;
}
/**
* @return \DateTime|null
*/
public function getDateStarting(): ?\DateTime
{
return $this->dateStarting;
}
/**
* @return Order[]|ArrayCollection
*/
public function getOrders()
{
return $this->orders;
}
/**
* @param Order[]|ArrayCollection $orders
*/
public function setOrders($orders): self
{
$this->orders = $orders;
return $this;
}
/**
* @return int|null
*/
public function getType(): ?int
{
return $this->type;
}
/**
* @param int|null $type
*/
public function setType(?int $type): void
{
$this->type = $type;
}
public function setCode(string $code): CodeDiscount
{
$this->code = $code;
return $this;
}
public function setActive(bool $active): CodeDiscount
{
$this->active = $active;
return $this;
}
public function setCustomer(?Customer $customer): CodeDiscount
{
$this->customer = $customer;
return $this;
}
public function setDiscount(float $discount): CodeDiscount
{
$this->discount = $discount;
return $this;
}
public function setDateExpiration(?\DateTime $dateExpiration): CodeDiscount
{
$this->dateExpiration = $dateExpiration;
return $this;
}
public function setDateStarting(?\DateTime $dateStarting): CodeDiscount
{
$this->dateStarting = $dateStarting;
return $this;
}
}