src/Entity/Category.php line 19

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: Sunendra Gajadhar
  5.  * Date: 2024-12-03
  6.  * Time: 22:58
  7.  */
  8. namespace App\Entity;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use DateTime;
  12. /**
  13.  * @ORM\Entity
  14.  * @ORM\HasLifecycleCallbacks
  15.  * @ORM\Table(name="category")
  16.  */
  17. class Category
  18. {
  19.     /**
  20.      * @ORM\Column(type="integer")
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue(strategy="AUTO")
  23.      */
  24.     protected $id;
  25.     /**
  26.      * @ORM\Column(name="name", type="string", length=255)
  27.      */
  28.     protected $name;
  29.     /**
  30.      * @ORM\Column(name="has_tvq", type="boolean", nullable=true)
  31.      */
  32.     protected $hasTvq;
  33.     /**
  34.      * @ORM\Column(name="has_tps", type="boolean", nullable=true)
  35.      */
  36.     protected $hasTps;
  37.     /**
  38.      * @ORM\Column(name="created_at", type="datetime")
  39.      */
  40.     protected $createdAt;
  41.     /**
  42.      * @ORM\Column(name="modified_at", type="datetime")
  43.      */
  44.     protected $modifiedAt;
  45.     /**
  46.      * @ORM\Column(name="modified_by", type="integer", nullable=true)
  47.      */
  48.     protected $modifiedBy;
  49.     public function __toString()
  50.     {
  51.         return $this->getName();
  52.     }
  53.     /**
  54.      * @return mixed
  55.      */
  56.     public function getId()
  57.     {
  58.         return $this->id;
  59.     }
  60.     /**
  61.      * @return mixed
  62.      */
  63.     public function getName()
  64.     {
  65.         return $this->name;
  66.     }
  67.     /**
  68.      * @param mixed $name
  69.      */
  70.     public function setName($name)
  71.     {
  72.         $this->name $name;
  73.     }
  74.     /**
  75.      * @return mixed
  76.      */
  77.     public function getHasTvq()
  78.     {
  79.         return $this->hasTvq;
  80.     }
  81.     /**
  82.      * @param mixed $hasTvq
  83.      */
  84.     public function setHasTvq($hasTvq 0)
  85.     {
  86.         $this->hasTvq $hasTvq;
  87.     }
  88.     /**
  89.      * @return mixed
  90.      */
  91.     public function getHasTps()
  92.     {
  93.         return $this->hasTps;
  94.     }
  95.     /**
  96.      * @param mixed $hasTps
  97.      */
  98.     public function setHasTps($hasTps 0)
  99.     {
  100.         $this->hasTps $hasTps;
  101.     }
  102.     /**
  103.      * @return mixed
  104.      */
  105.     public function getCreatedAt()
  106.     {
  107.         return $this->createdAt;
  108.     }
  109.     /**
  110.      * @param mixed $createdAt
  111.      */
  112.     public function setCreatedAt($createdAt): void
  113.     {
  114.         $this->createdAt $createdAt;
  115.     }
  116.     /**
  117.      * @return mixed
  118.      */
  119.     public function getModifiedAt()
  120.     {
  121.         return $this->modifiedAt;
  122.     }
  123.     /**
  124.      * @param mixed $modifiedAt
  125.      */
  126.     public function setModifiedAt($modifiedAt): void
  127.     {
  128.         $this->$modifiedAt $modifiedAt;
  129.     }
  130.     /**
  131.      * @return mixed
  132.      */
  133.     public function getModifiedBy()
  134.     {
  135.         return $this->modifiedBy;
  136.     }
  137.     /**
  138.      * @param mixed $modifiedBy
  139.      */
  140.     public function setModifiedBy($modifiedBy): void
  141.     {
  142.         $this->modifiedBy $modifiedBy;
  143.     }
  144.     // Lifecycle Callbacks
  145.     /**
  146.      * @ORM\PrePersist
  147.      */
  148.     public function onPrePersist(): void
  149.     {
  150.         $this->createdAt  = new DateTime();
  151.         $this->modifiedAt = new DateTime();
  152.     }
  153.     /**
  154.      * @ORM\PreUpdate
  155.      */
  156.     public function onPreUpdate(): void
  157.     {
  158.         $this->modifiedAt = new DateTime();
  159.     }
  160. }