how access the tmp file created by CrauFormFlow bundle

I use the CraueFormFlow bundle to create events in my symfonyApp.

So it work well but I would like to create at the very end a recap of all the values entered by the user. One of the field is a file but I cannot manage to find where the tmp file is stored and if it is actually created.
The image is an Entity managed with the vichUploader bundle.

I use the following form:

class SortieType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        switch ($options['flow_step']) {
            case 1:
                $builder
                    ->add('titre')
                    ->add('tag', EntityType::class)
                    ->add('description', CKEditorType::class)
                    ->add('lieu', LieuType::class);
                break;
            case 2:
                $builder
                    ->add('debut', DateType::class)
                    ->add('fin', DateType::class);
                break;
            case 3:
                $builder
                    ->add('image', ImageType::class)
                    ->add('nbPlace')
                    ->add('prix')
                    ->add('finInscription', DateType::class);
                break;
            case 4:
                $builder
                    ->add('hebergement', AssoType::class);
                break;
            case 5:
                $builder
                    ->add('club', AssoType::class);
                break;
        }
    }
}

in the following flow

use CraueFormFlowBundleFormFormFlow;

class SortieFlow extends FormFlow
{
    protected $allowDynamicStepNavigation = true;

    protected function loadStepsConfig()
    {
        return [
            [
                'label' => 'informations',
                'form_type' => SortieType::class,
            ],
            [
                'label' => 'dates',
                'form_type' => SortieType::class,
            ],
            [
                'label' => 'details',
                'form_type' => SortieType::class,
            ],
            [
                'label' => 'hebergement',
                'form_type' => SortieType::class,
            ],
            [
                'label' => 'club',
                'form_type' => SortieType::class,
            ],
            [
                'label' => 'confirmation',
            ],
        ];
    }
}

In my twig I tried the following on the last step but without success

{% set file = flow.formData.image.imageFile %}
{{ dump(flow.formData.image.imageFile) }}
{# TODO comprendre où est rangée cette putain d'image #}
<img id="imageFile" src="{{ asset(file.realPath) }}" class="img-rounded col-lg-12" alt="baniere">

Does anyone has already tried to display an image before flushing the entity ?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *