You are here

public function DateRecurRRule::getOccurrencesForCacheStorage in Recurring Dates Field 8

Get the occurrences for storage in the cache table (for views).

Parameters

\DateTime $until For infinite dates create until that date.:

string $storageFormat The desired date format.:

Return value

array

See also

DateRecurFieldItemList::postSave()

File

src/DateRecurRRule.php, line 246

Class

DateRecurRRule

Namespace

Drupal\date_recur

Code

public function getOccurrencesForCacheStorage(\DateTime $until, $storageFormat) {
  $occurrences = [];
  if (!$this->rrule
    ->isInfinite()) {
    $occurrences += $this
      ->createOccurrences(NULL, NULL, NULL, FALSE);
  }
  else {
    $occurrences += $this
      ->createOccurrences(NULL, $until, NULL, FALSE);
  }
  foreach ($occurrences as &$row) {
    foreach ($row as $key => $date) {
      if (!empty($date)) {
        $row[$key] = self::massageDateValueForStorage($date, $storageFormat);
      }
    }
  }
  return $occurrences;
}