/**
  * @param int $lastN
  * @return string[]
  */
 private function getLastNTableMonths($lastN)
 {
     $now = Date::factory('now');
     $result = array();
     for ($i = 0; $i < $lastN; ++$i) {
         $date = $now->subMonth($i + 1);
         $result[] = ArchiveTableCreator::getTableMonthFromDate($date);
     }
     return $result;
 }
 /**
  * Called when deleting all periods.
  *
  * @param Date[] $dates
  * @return string[][][]
  */
 private function getDatesByYearMonthAndPeriodType($dates)
 {
     $result = array();
     foreach ($dates as $date) {
         $yearMonth = ArchiveTableCreator::getTableMonthFromDate($date);
         $result[$yearMonth][null][] = $date->toString();
         // since we're removing all periods, we must make sure to remove year periods as well.
         // this means we have to make sure the january table is processed.
         $janYearMonth = $date->toString('Y') . '_01';
         $result[$janYearMonth][null][] = $date->toString();
     }
     return $result;
 }