protected function processImageUpdate($entityId, $entity)
 {
     $file = $this->getRequest()->files->all();
     reset($file);
     $file = current($file);
     $fileController = new FileController();
     $fileController->setContainer($this->getContainer());
     $config = FileConfiguration::getImageConfig();
     $errors = $this->processImage($fileController, $file, $entityId, $entity, $config);
     if (!empty($errors)) {
         throw new HttpException(500, json_encode($errors), null, ["Content-Type" => "application/json"]);
     }
 }
示例#2
0
 /**
  * Manage how a document collection has to be saved
  *
  * @param int    $parentId   Parent id owning documents being saved
  * @param string $parentType Parent Type owning documents being saved
  *
  * @return Response
  */
 public function saveDocumentAjaxAction($parentId, $parentType)
 {
     $config = FileConfiguration::getDocumentConfig();
     return $this->saveFileAjaxAction($parentId, $parentType, $config['objectType'], $config['validMimeTypes'], $config['extBlackList']);
 }