Symfony2 - the good way to add an image in our entity

entity-framework symfony

Question

Actually I have a "Movie" entity and I want to add a new attribute like "picture". Of course I have to add this attribute in my entity "Movie".

But I was wondering if I have to set some parameters like size, extension in my mapping comments.

Then, as I have not created yet my add for and edit form... I add manually datas in my database for testing my scripts. Does the "picture" column contain only the name of the image like "toto.png" ? If it's the case, what is the directory which will save the images ?

1
1
8/6/2012 11:24:49 AM

Accepted Answer

Assuming you use Doctrine as ORM, I suggest reading up on file uploads in the Symfony documentation. It describes the fields to create, form and upload handling. But yes, you basically store the filename in the field "picture" and create additional functions to help figure out the true path to the file.

4
8/6/2012 11:44:54 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow