<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Groups;
/**
* @ORM\Table("Bonus")
*
* @ORM\HasLifecycleCallbacks()
*
* @ORM\Entity(repositoryClass="App\Repository\BonusRepository")
*/
class Bonus
{
/**
* @Groups({"bonusindex"})
*
* @ORM\Id()
*
* @ORM\GeneratedValue()
*
* @ORM\Column(type="integer")
*/
private $id;
/**
* @Groups({"bonusindex"})
*
* @ORM\Column(type="datetime")
*/
private $bonus_begin;
/**
* @Groups({"bonusindex"})
*
* @ORM\Column(type="datetime")
*/
private $bonus_end;
/**
* @ORM\Column(type="datetime")
*/
private $created_at;
/**
* @Groups({"bonusindex"})
*
* @ORM\Column(type="decimal", precision=5, scale=2)
*/
private $percent = 0.0;
/**
* @ORM\PrePersist()
*/
public function prePersist()
{
if (!$this->getCreatedAt()) {
$this->setCreatedAt(new \DateTime());
}
}
public function getId()
{
return $this->id;
}
public function getBonusBegin(): ?\DateTimeInterface
{
return $this->bonus_begin;
}
public function setBonusBegin(\DateTimeInterface $bonus_begin): self
{
$this->bonus_begin = $bonus_begin;
return $this;
}
public function getBonusEnd(): ?\DateTimeInterface
{
return $this->bonus_end;
}
public function setBonusEnd(\DateTimeInterface $bonus_end): self
{
$this->bonus_end = $bonus_end;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getPercent(): float
{
return $this->percent;
}
public function setPercent(float $percent): self
{
$this->percent = $percent;
return $this;
}
}