示例#1
0
 public function LoadAll()
 {
     $quotas = array();
     $command = new GetAllQuotasCommand();
     $reader = ServiceLocator::GetDatabase()->Query($command);
     while ($row = $reader->GetRow()) {
         $quotaId = $row[ColumnNames::QUOTA_ID];
         $limit = Quota::CreateLimit($row[ColumnNames::QUOTA_LIMIT], $row[ColumnNames::QUOTA_UNIT]);
         $duration = Quota::CreateDuration($row[ColumnNames::QUOTA_DURATION]);
         $resourceId = $row[ColumnNames::RESOURCE_ID];
         $groupId = $row[ColumnNames::GROUP_ID];
         $scheduleId = $row[ColumnNames::SCHEDULE_ID];
         $quotas[] = new Quota($quotaId, $duration, $limit, $resourceId, $groupId, $scheduleId);
     }
     return $quotas;
 }