db = $db; // Run once a day at off-peak time $this->setInterval(24 * 60 * 60); $this->setTimeSensitivity(self::TIME_INSENSITIVE); } public function run($argument) { $query = $this->db->getQueryBuilder(); $query->delete('calendar_invitations') ->where($query->expr()->lt('expiration', $query->createNamedParameter($this->time->getTime()))) ->execute(); } }