You are here

public function Event::setEndDate in Booking and Availability Management Tools for Drupal 8

Overrides EventInterface::setEndDate

File

modules/bat_event/src/Entity/Event.php, line 178
Contains \Drupal\bat_event\Entity\Event.

Class

Event
Defines the Event entity.

Namespace

Drupal\bat_event\Entity

Code

public function setEndDate(\DateTime $date) {
  $value = [
    'value' => $this
      ->getStartDate()
      ->format('Y-m-d\\TH:i:00'),
    'end_value' => $date
      ->format('Y-m-d\\TH:i:00'),
  ];
  $this
    ->set('event_dates', $value);
}