Example #1
0
 /**
  * @param Shift $shift
  */
 public function assignShift(Shift $shift)
 {
     $this->shift = $shift;
     $shift->assignDrivingAssertion($this);
     /*
      * set sortOrder to shifts working day + start time
      * this is redundant, but needed for sorting in DataGrid
      */
     $localDate = clone $shift->getDate();
     // date in timezone Europe/Paris
     $utcStart = clone $shift->getStart();
     // time in timezone UTC
     $utcStart->setTimezone($localDate->getTimezone());
     $localDate->setTime($utcStart->format('H'), $utcStart->format('i'));
     $localDate->setTimezone(new \DateTimeZone('UTC'));
     $this->sortOrder = $localDate;
 }