Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mappings configurations when uploading multiple files #879

Closed
Blqck666 opened this issue Jun 19, 2018 · 4 comments
Closed

Mappings configurations when uploading multiple files #879

Blqck666 opened this issue Jun 19, 2018 · 4 comments
Labels

Comments

@Blqck666
Copy link

Blqck666 commented Jun 19, 2018

Q A
Version x.y.z

Support Question

im uploading multiple images in one entity i made a configuration like this

parameters:
    app.path.coloriage_images: /web/images/coloriage
    app.path.coloriage_images2: /web/images/coloriage2


coloriage_images:
                    uri_prefix: '%app.path.coloriage_images%'
                    upload_destination:  '%kernel.root_dir%/../web/images/coloriage' 
                    namer:
                        service: vich_uploader.namer_uniqid
coloriage_images2:
                    uri_prefix: '%app.path.coloriage_images%'
                    upload_destination:  '%kernel.root_dir%/../web/images/coloriage2' 
                    namer:
                        service: vich_uploader.namer_uniqid
/**
     * @ORM\Column(type="string", length=255)
     * @var string
     */
    private $img;

    /**
     * @Vich\UploadableField(mapping="coloriage_images", fileNameProperty="img")
     * @var File
     */

    private $imageFile;


    /**
     * @ORM\Column(type="string", length=255)
     * @var string
     */
    private $img2;

    /**
     * @Vich\UploadableField(mapping="coloriage_images2", fileNameProperty="img2")
     * @var File
     */

    private $imageFile2;

and i m still getting this :

An exception occurred while executing 'INSERT INTO coloriages (img, img2, name, description, categorie, updated_at, created_at, createdBy) VALUES (?, ?, ?, ?, ?, ?, ?, ?)' with params ["5b290f8d8a7a3.jpg", null, "qsdukhj", "qsdgf", "qsdfg", "2018-06-19 14:13:33", "2018-06-19 14:13:33", null]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Le champ 'img2' ne peut être vide (null)

@garak garak added the Support label Jun 19, 2018
@wakori
Copy link

wakori commented Jul 30, 2018

Following this. I have the same issue..

@gilsondelrei
Copy link

gilsondelrei commented Jul 30, 2018 via email

@garak
Copy link
Collaborator

garak commented Jul 30, 2018

Set your property as nullable

@garak
Copy link
Collaborator

garak commented Aug 15, 2018

Hope you solved. Closing

@garak garak closed this as completed Aug 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants