src/CRUDlex/Controller.php
protected function modifyFilesAndSetFlashBag(Request $request, AbstractData $crudData, Entity $instance, $entity, $mode)
    {
        $id          = $instance->get('id');
        $fileHandler = new FileHandler($this->filesystem, $crudData->getDefinition());
        $result      = $mode == 'edit' ? $fileHandler->updateFiles($crudData, $request, $instance, $entity) : $fileHandler->createFiles($crudData, $request, $instance, $entity);
        if (!$result) {
            return null;
        }
        $this->session->getFlashBag()->add('success', $this->translator->trans('crudlex.'.$mode.'.success', [
            '%label%' => $crudData->getDefinition()->getLabel(),
            '%id%' => $id
        ]));
        return new RedirectResponse($this->service->generateURL('crudShow', ['entity' => $entity, 'id' => $id]));
    }
protected function modifyFilesAndSetFlashBag(Request $request, AbstractData $crudData, Entity $instance, $entity, $mode)
    {
        $id          = $instance->get('id');
        $fileHandler = new FileHandler($this->filesystem, $crudData->getDefinition());
        $result      = $mode == 'edit' ? $fileHandler->updateFiles($crudData, $request, $instance, $entity) : $fileHandler->createFiles($crudData, $request, $instance, $entity);
        if (!$result) {
            return null;
        }
        $this->session->getFlashBag()->add('success', $this->translator->trans('crudlex.'.$mode.'.success', [
            '%label%' => $crudData->getDefinition()->getLabel(),
            '%id%' => $id
        ]));
        return new RedirectResponse($this->service->generateURL('crudShow', ['entity' => $entity, 'id' => $id]));
    }
protected function modifyFilesAndSetFlashBag ( Request $ request , AbstractData $ crudData , Entity $ instance , $ entity , $ mode ) { $ id = $ instance -> get ( 'id' ) ; $ fileHandler = new FileHandler ( $ this -> filesystem , $ crudData -> getDefinition ( ) ) ; $ result = $ mode == 'edit' ? $ fileHandler -> updateFiles ( $ crudData , $ request , $ instance , $ entity ) : $ fileHandler -> createFiles ( $ crudData , $ request , $ instance , $ entity ) ; if ( ! $ result ) { return null ; } $ this -> session -> getFlashBag ( ) -> add ( 'success' , $ this -> translator -> trans ( 'crudlex.' . $ mode . '.success' , [ '%label%' => $ crudData -> getDefinition ( ) -> getLabel ( ) , '%id%' => $ id ] ) ) ; return new RedirectResponse ( $ this -> service -> generateURL ( 'crudShow' , [ 'entity' => $ entity , 'id' => $ id ] ) ) ; }
Postprocesses the entity after modification by handling the uploaded
files and setting the flash.

@param Request $request
the current request
@param AbstractData $crudData
the data instance of the entity
@param Entity $instance
the entity
@param string $entity
the name of the entity
@param string $mode
whether to 'edit' or to 'create' the entity

@return null|\Symfony\Component\HttpFoundation\RedirectResponse
the HTTP response of this modification
Postprocesses the entity after modification by handling the uploaded files and setting the flash .