Hello,

I've spent some time to play with the new form framework, and then I have
some questions about its usage.

First case, how to have two validation strategy for the same class, using
annotations:

I have a User entity, and two forms: a subscribe form, and a "edit profile"
form. In the first one, I have two fields: the username, and the password.
In the second, username, password, first name and last name.
Actually, if I add the annotation "@validation:NotBlank" on the first name
and last name fields, I can't validate the first form (I have the error
"This field cannot be blank").
Is it just possible? How can I do that?

Second case, file uploads

Now, I want my user to be able to upload an avatar. So, I added a file field
in my form, and added a validator. Naively, I first tried to handle the
upload process in my User::setAvatar() method, and moved the image to the
upload dir. It won't worked : there was a validation error because the
uploaded image did not exists. So, I moved this process in a prePersist()
method, but is it normal that my object is modified even if the values are
not yet validated?

Thanks

-- 
Noël GUILBERT
http://www.noelguilbert.com/
Twitter : http://twitter.com/noelguilbert
http://www.sensiolabs.com
http://www.symfony-project.com
Sensio Labs
Tél: +33 1 40 99 80 80

-- 
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 users" 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-users?hl=en

Reply via email to