I love the form framework!  It's fantastic.  I'd like to weigh in on
the FileType questions...

Why should Doctrine be concerned with moving files around on the
server?  Maybe in some cases, but it seems like the model should not
always need to know this. Should the moving of the file happen in
validation?  This makes a little bit more sense to me, as then it
won't be persisted until this happens, and won't be set to the model
if there's an error.  I agree that ALL the FormType field should do is
upload. Additional logic like moving and renaming doesn't belong.  But
where then is the best place for that logic?

Also, the "string type" option, which is the default, does not provide
the uploaded file's extension.  I feel like this is an issue.

On Apr 24, 4:35 pm, Bernhard Schussek <[email protected]> wrote:
> 2011/4/24 ornicar <[email protected]>:
>
> > I would not write
> > $path = realpath(__DIR__.'/../../../../web/uploads');
>
> > in a model, for obvious reusability and maintainability reasons.
> > The model can at most know the path relative to the document root or uploads
> > dir.
> > But absolute file path calculation should be done in a configurable service.
>
> You're absolutely right. I was trying to keep the example simple.
>
> Maybe we can write a generic Doctrine2 listener that takes care of the
> above job. Volunteers?
>
> Bernhard

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to