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

Uploadable sets value to null if no image is selected #223

Open
electricBonfire opened this issue Nov 27, 2013 · 4 comments
Open

Uploadable sets value to null if no image is selected #223

electricBonfire opened this issue Nov 27, 2013 · 4 comments

Comments

@electricBonfire
Copy link

I am having an issue with Uploadable. I have added an avatar property to my user. If the user updates his profile but does not change their avatar the column in the database gets set to null.

I noticed in the docs it said to add this to the form builder: ->add('avatar')
This was rendering a text input and not a file input.

I had to use this to get the file input: ->add('avatar', 'file', array('required' => false, 'data_class' => null))

I am guessing something might not be configured correctly, The upload does seem to work when actually trying to update the avatar however.

I have the following in my config.yml:

doctrine:
   orm:
       auto_mapping: true
.....
stof_doctrine_extensions:
    orm:
        default:
            uploadable: true
@cazzoo
Copy link

cazzoo commented Aug 9, 2015

I encounter the same issue here when updating my previously added entity..
The "file" form type should not trigger the update of the entity but indeed it's updated and the path is set to NULL into the database..
I still found no solution, tried many things with no success.

Any help?

@charlie-wasp
Copy link

@cazzoo @shawn-northrop did you find solution, guys? I am fighting the same battle now 😄

@cazzoo
Copy link

cazzoo commented Nov 5, 2015

No I'm not, I did a workaround that allow me single file to upload through a collection manager (UI)

@stof
Copy link
Owner

stof commented Nov 5, 2015

Well, without seeing your class and what happens in setAvatar, I cannot help you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants