102 lines
1.9 KiB
PHP
102 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="promo")
|
|
* @UniqueEntity("code")
|
|
*/
|
|
class Promo
|
|
{
|
|
// unique id
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="integer")
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
protected $id;
|
|
|
|
// name
|
|
/**
|
|
* @ORM\Column(type="string", length=80)
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $name;
|
|
|
|
// code
|
|
/**
|
|
* @ORM\Column(type="string", length=80, unique=true)
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $code;
|
|
|
|
// discount rate (multiplier)
|
|
/**
|
|
* @ORM\Column(type="decimal", precision=11, scale=10)
|
|
* @Assert\NotBlank()
|
|
* @Assert\Range(min=0, minMessage="This value should be a valid number.")
|
|
*/
|
|
protected $discount_rate;
|
|
|
|
// price discount applies to
|
|
/**
|
|
* @ORM\Column(type="string", length=10)
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $discount_apply;
|
|
|
|
public function getID()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setName($name)
|
|
{
|
|
$this->name = $name;
|
|
return $this;
|
|
}
|
|
|
|
public function getName()
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function setCode($code)
|
|
{
|
|
$this->code = $code;
|
|
return $this;
|
|
}
|
|
|
|
public function getCode()
|
|
{
|
|
return $this->code;
|
|
}
|
|
|
|
public function setDiscountRate($discount_rate)
|
|
{
|
|
$this->discount_rate = $discount_rate;
|
|
return $this;
|
|
}
|
|
|
|
public function getDiscountRate()
|
|
{
|
|
return $this->discount_rate;
|
|
}
|
|
|
|
public function setDiscountApply($discount_apply)
|
|
{
|
|
$this->discount_apply = $discount_apply;
|
|
return $this;
|
|
}
|
|
|
|
public function getDiscountApply()
|
|
{
|
|
return $this->discount_apply;
|
|
}
|
|
}
|