public function Update(Schedule $schedule)
 {
     $user = $this->repo->LoadById($this->user->UserId);
     if (!$user->IsScheduleAdminFor($schedule)) {
         // if we got to this point, the user does not have the ability to update the schedule
         throw new Exception(sprintf('Schedule Update Failed. User %s does not have admin access to schedule %s.', $this->user->UserId, $schedule->GetId()));
     }
     parent::Update($schedule);
 }
 public function testCanUpdateSchedule()
 {
     $id = 10;
     $name = 'super schedule';
     $isDefault = 0;
     $weekdayStart = 5;
     $daysVisible = 3;
     $subscriptionEnabled = true;
     $adminGroupId = 123;
     $schedule = new Schedule($id, $name, $isDefault, $weekdayStart, $daysVisible);
     $schedule->EnableSubscription();
     $publicId = $schedule->GetPublicId();
     $schedule->SetAdminGroupId($adminGroupId);
     $this->scheduleRepository->Update($schedule);
     $this->assertEquals(new UpdateScheduleCommand($id, $name, $isDefault, $weekdayStart, $daysVisible, $subscriptionEnabled, $publicId, $adminGroupId), $this->db->_LastCommand);
 }