Add PropertyFromHttp trait and update codebase to use new pattern

This commit is contained in:
Alex Cabal 2024-11-10 22:23:43 -06:00
parent c35c47b793
commit acb30b897c
47 changed files with 851 additions and 527 deletions

View file

@ -18,15 +18,10 @@ class DonationDrive{
public function __construct(public string $Name, public DateTimeImmutable $Start, public DateTimeImmutable $End, public int $BaseTargetDonationCount, public int $StretchTargetDonationCount){
}
public static function GetByIsRunning(): ?DonationDrive{
foreach(DONATION_DRIVE_DATES as $donationDrive){
if(NOW > $donationDrive->Start && NOW < $donationDrive->End){
return $donationDrive;
}
}
return null;
}
// *******
// GETTERS
// *******
protected function GetDonationCount(): int{
if(!isset($this->_DonationCount)){
@ -92,4 +87,19 @@ class DonationDrive{
return $this->_IsStretchEnabled;
}
// ***********
// ORM METHODS
// ***********
public static function GetByIsRunning(): ?DonationDrive{
foreach(DONATION_DRIVE_DATES as $donationDrive){
if(NOW > $donationDrive->Start && NOW < $donationDrive->End){
return $donationDrive;
}
}
return null;
}
}