You are here

public function PeriodEntityTrait::getEndDate in Recurring Time Period 8

Implements \Drupal\recurring_period\Entity\PeriodEntityInterface::getEndDate().

File

src/Entity/PeriodEntityTrait.php, line 47

Class

PeriodEntityTrait
Provides base fields and accessors for entities that represent a time period.

Namespace

Drupal\recurring_period\Entity

Code

public function getEndDate() {
  if ($this
    ->getEntityType()
    ->hasKey('date_range')) {
    $date_range_field = $this
      ->getEntityType()
      ->getKey('date_range');
    return $this->{$date_range_field}->end_date;
  }
  else {
    $end_date_field = $this
      ->getEntityType()
      ->getKey('end_date');
    return $this->{$end_date_field}->date;
  }
}