src/Entity/MaintenanceSchedule.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AddresseRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\DBAL\Types\Types;
  6. use App\Repository\MaintenanceScheduleRepository;
  7. #[ORM\Entity(repositoryClassMaintenanceScheduleRepository::class)]
  8. // #[ORM\Entity(repositoryClass: App\Repository\MaintenanceScheduleRepository::class)]
  9. class MaintenanceSchedule
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  16.     private \DateTimeInterface $startTime;
  17.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  18.     private \DateTimeInterface $endTime;
  19.     #[ORM\Column(type'string'length255nullabletrue)]
  20.     private ?string $description null;
  21.     #[ORM\Column(type'boolean')]
  22.     private bool $isActive true;
  23.     // Getters and Setters ...
  24.     public function isInProgress(): bool
  25.     {
  26.         $now = new \DateTime();
  27.         return $this->isActive && $now >= $this->startTime && $now <= $this->endTime;
  28.     }
  29.     /**
  30.      * Get the value of startTime
  31.      */ 
  32.     public function getStartTime()
  33.     {
  34.         return $this->startTime;
  35.     }
  36.     /**
  37.      * Set the value of startTime
  38.      *
  39.      * @return  self
  40.      */ 
  41.     public function setStartTime($startTime)
  42.     {
  43.         $this->startTime $startTime;
  44.         return $this;
  45.     }
  46.     /**
  47.      * Get the value of endTime
  48.      */ 
  49.     public function getEndTime()
  50.     {
  51.         return $this->endTime;
  52.     }
  53.     /**
  54.      * Set the value of endTime
  55.      *
  56.      * @return  self
  57.      */ 
  58.     public function setEndTime($endTime)
  59.     {
  60.         $this->endTime $endTime;
  61.         return $this;
  62.     }
  63.     /**
  64.      * Get the value of description
  65.      */ 
  66.     public function getDescription()
  67.     {
  68.         return $this->description;
  69.     }
  70.     /**
  71.      * Set the value of description
  72.      *
  73.      * @return  self
  74.      */ 
  75.     public function setDescription($description)
  76.     {
  77.         $this->description $description;
  78.         return $this;
  79.     }
  80.     /**
  81.      * Get the value of isActive
  82.      */ 
  83.     public function getIsActive()
  84.     {
  85.         return $this->isActive;
  86.     }
  87.     /**
  88.      * Set the value of isActive
  89.      *
  90.      * @return  self
  91.      */ 
  92.     public function setIsActive($isActive)
  93.     {
  94.         $this->isActive $isActive;
  95.         return $this;
  96.     }
  97.     /**
  98.      * Get the value of id
  99.      */ 
  100.     public function getId()
  101.     {
  102.         return $this->id;
  103.     }
  104. }