/**
  * @param Request $request
  * @param string $uriEvent
  * @return Response
  * @throws \Exception
  *
  * @ApiDoc(
  *  description="Update the event with the given uri",
  *  requirements={
  *      {
  *          "name"="uriEvent",
  *          "dataType"="string",
  *          "description"="The uri of the event",
  *      }
  *  },
  *  parameters={
  *      {
  *          "name"="some_property",
  *          "dataType"="string",
  *          "required"=false,
  *          "description"="Some property to update"
  *      }
  *  }
  * )
  */
 public function updateEventAction(Request $request, $uriEvent)
 {
     $rawEvent = $this->get('pmanager')->findById('public', 'calendarobject', $uriEvent);
     if ($rawEvent == null) {
         return $this->buildError('404', 'The event with the given uri could not be found.');
     }
     $params = array();
     $content = $request->getContent();
     if (!empty($content)) {
         $params = json_decode($content, true);
     }
     $event = new Event();
     $event->loadFromCalData($rawEvent->calendarData);
     foreach ($params as $name => $value) {
         $event->__set($name, $value);
     }
     $calendarBackend = new CalendarBackend($this->get('pmanager'), $this->generateUrl('event_read', [], true), $this->get('slugify'));
     $calendarBackend->updateCalendarObject($rawEvent->calendarid, $rawEvent->uri, $event->getVObject()->serialize());
     return $this->buildResponse(['event' => 'updated']);
 }