/** * Override to be able to return both file path and export path in case of copy * * {@inheritdoc} */ public function normalize($object, $format = null, array $context = array()) { if (isset($context['prepare_copy'])) { $identifier = isset($context['identifier']) ? $context['identifier'] : null; return ['filePath' => $this->manager->getFilePath($object), 'exportPath' => $this->manager->getExportPath($object, $identifier)]; } return [$this->getFieldName($object, $context) => $this->doNormalize($object, $format, $context)]; }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = []) { $file = $object->getFile(); if (null !== $file && $file instanceof UploadedFile) { // happens in case of mass edition return ['originalFilename' => $file->getClientOriginalName(), 'filePath' => $file->getPathname()]; } return ['originalFilename' => $object->getOriginalFilename(), 'filePath' => $this->manager->getFilePath($object, false)]; }