예제 #1
0
 public function updateTimes(Show $show)
 {
     $min = null;
     $max = null;
     foreach ($show->getPerformances() as $performance) {
         if (is_null($min) || $performance->getStartDate() < $min) {
             $min = $performance->getStartDate();
         }
         if (is_null($max) || $performance->getEndDate() > $max) {
             $max = $performance->getEndDate();
         }
     }
     $show->setStartAt($min);
     $show->setEndAt($max);
 }