src/Entity/Bonus.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JMS\Serializer\Annotation\Groups;
  5. /**
  6.  * @ORM\Table("Bonus")
  7.  *
  8.  * @ORM\HasLifecycleCallbacks()
  9.  *
  10.  * @ORM\Entity(repositoryClass="App\Repository\BonusRepository")
  11.  */
  12. class Bonus
  13. {
  14.     /**
  15.      * @Groups({"bonusindex"})
  16.      *
  17.      * @ORM\Id()
  18.      *
  19.      * @ORM\GeneratedValue()
  20.      *
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @Groups({"bonusindex"})
  26.      *
  27.      * @ORM\Column(type="datetime")
  28.      */
  29.     private $bonus_begin;
  30.     /**
  31.      * @Groups({"bonusindex"})
  32.      *
  33.      * @ORM\Column(type="datetime")
  34.      */
  35.     private $bonus_end;
  36.     /**
  37.      * @ORM\Column(type="datetime")
  38.      */
  39.     private $created_at;
  40.     /**
  41.      * @Groups({"bonusindex"})
  42.      *
  43.      * @ORM\Column(type="decimal", precision=5, scale=2)
  44.      */
  45.     private $percent 0.0;
  46.     /**
  47.      * @ORM\PrePersist()
  48.      */
  49.     public function prePersist()
  50.     {
  51.         if (!$this->getCreatedAt()) {
  52.             $this->setCreatedAt(new \DateTime());
  53.         }
  54.     }
  55.     public function getId()
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getBonusBegin(): ?\DateTimeInterface
  60.     {
  61.         return $this->bonus_begin;
  62.     }
  63.     public function setBonusBegin(\DateTimeInterface $bonus_begin): self
  64.     {
  65.         $this->bonus_begin $bonus_begin;
  66.         return $this;
  67.     }
  68.     public function getBonusEnd(): ?\DateTimeInterface
  69.     {
  70.         return $this->bonus_end;
  71.     }
  72.     public function setBonusEnd(\DateTimeInterface $bonus_end): self
  73.     {
  74.         $this->bonus_end $bonus_end;
  75.         return $this;
  76.     }
  77.     public function getCreatedAt(): ?\DateTimeInterface
  78.     {
  79.         return $this->created_at;
  80.     }
  81.     public function setCreatedAt(\DateTimeInterface $created_at): self
  82.     {
  83.         $this->created_at $created_at;
  84.         return $this;
  85.     }
  86.     public function getPercent(): float
  87.     {
  88.         return $this->percent;
  89.     }
  90.     public function setPercent(float $percent): self
  91.     {
  92.         $this->percent $percent;
  93.         return $this;
  94.     }
  95. }