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"]); } }