#!/usr/bin/php = p.BaseCost and py.Created > ? - interval 45 day) or (IsRecurring = false and CycleType = ? and Amount >= p.BaseCost and py.Created > ? - interval 1 year) ) ) ', [Enums\CycleType::Monthly, NOW, Enums\CycleType::Yearly, NOW], Patron::class); if(sizeof($expiredPatrons) > 0){ $ebooksThisYear = Db::QueryInt('SELECT count(*) from Ebooks where EbookCreated >= ? - interval 1 year', [NOW]); foreach($expiredPatrons as $patron){ $patron->End($ebooksThisYear); } }