<?php
namespace App\Entity;
use App\Repository\AddresseRepository;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\DBAL\Types\Types;
use App\Repository\MaintenanceScheduleRepository;
#[ORM\Entity(repositoryClass: MaintenanceScheduleRepository::class)]
// #[ORM\Entity(repositoryClass: App\Repository\MaintenanceScheduleRepository::class)]
class MaintenanceSchedule
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private \DateTimeInterface $startTime;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private \DateTimeInterface $endTime;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $description = null;
#[ORM\Column(type: 'boolean')]
private bool $isActive = true;
// Getters and Setters ...
public function isInProgress(): bool
{
$now = new \DateTime();
return $this->isActive && $now >= $this->startTime && $now <= $this->endTime;
}
/**
* Get the value of startTime
*/
public function getStartTime()
{
return $this->startTime;
}
/**
* Set the value of startTime
*
* @return self
*/
public function setStartTime($startTime)
{
$this->startTime = $startTime;
return $this;
}
/**
* Get the value of endTime
*/
public function getEndTime()
{
return $this->endTime;
}
/**
* Set the value of endTime
*
* @return self
*/
public function setEndTime($endTime)
{
$this->endTime = $endTime;
return $this;
}
/**
* Get the value of description
*/
public function getDescription()
{
return $this->description;
}
/**
* Set the value of description
*
* @return self
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get the value of isActive
*/
public function getIsActive()
{
return $this->isActive;
}
/**
* Set the value of isActive
*
* @return self
*/
public function setIsActive($isActive)
{
$this->isActive = $isActive;
return $this;
}
/**
* Get the value of id
*/
public function getId()
{
return $this->id;
}
}