You are here

protected function DateRecurOccurrences::getOccurrencesForCacheStorage in Recurring Dates Field 3.1.x

Same name and namespace in other branches
  1. 8.2 src/DateRecurOccurrences.php \Drupal\date_recur\DateRecurOccurrences::getOccurrencesForCacheStorage()
  2. 3.x src/DateRecurOccurrences.php \Drupal\date_recur\DateRecurOccurrences::getOccurrencesForCacheStorage()
  3. 3.0.x src/DateRecurOccurrences.php \Drupal\date_recur\DateRecurOccurrences::getOccurrencesForCacheStorage()

Get all occurrences needing to be stored.

Parameters

\Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item: The date recur field item.

Return value

\Drupal\date_recur\DateRange[] Date range objects for storage.

1 call to DateRecurOccurrences::getOccurrencesForCacheStorage()
DateRecurOccurrences::saveItem in src/DateRecurOccurrences.php
Create table rows from occurrences for a single field value.

File

src/DateRecurOccurrences.php, line 282

Class

DateRecurOccurrences
Manages occurrences tables and the data that populates them.

Namespace

Drupal\date_recur

Code

protected function getOccurrencesForCacheStorage(DateRecurItem $item) : array {
  $until = NULL;
  if ($item
    ->getHelper()
    ->isInfinite()) {
    $until = (new \DateTime('now'))
      ->add(new \DateInterval($item
      ->getFieldDefinition()
      ->getSetting('precreate')));
  }
  return $item
    ->getHelper()
    ->getOccurrences(NULL, $until);
}