W
W
wittyrider2015-08-16 22:53:16
symfony
wittyrider, 2015-08-16 22:53:16

VichUploaderBundle not saving file?

# src/AppBundle/Entity/Video
   /**
     * @Vich\UploadableField(mapping="user_videos", fileNameProperty="original")
     * @var \Symfony\Component\HttpFoundation\File\UploadedFile
     */
    private $originalFile;

# app/config/config.yml
....
oneup_flysystem:
    adapters:
        my_adapter:
            local:
                directory: %kernel.root_dir%/../web/uploads

    filesystems:
        my_fs:
            adapter:    my_adapter

vich_uploader:
    db_driver: orm
    storage:   flysystem
    mappings:
        user_videos:
#            uri_prefix:         /user_videos
            upload_destination: my_fs
            inject_on_load:     true
            delete_on_update:   true
            delete_on_remove:   true

I get an error when updating:
An exception occurred while executing 'INSERT INTO videos (updated_at, created_at, original, user_id) VALUES (?, ?, ?, ?)' with params [\"2015-08-17 00:48:55\", \"2015-08-17 00:48:55\", null, null]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1048 Column 'original' cannot be null

Who faced it?
Tell me which way to dig?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wittyrider, 2015-08-17
@wittyrider

The problem was that vichuploader cached the metadata (@Vich\Uploadable).
ps strange that it caches metadata even in dev environment

R
Ruslan Kvashnin, 2015-08-17
@RussellKvashnin

The class itself has the @Vich\Uploadable annotation?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question