Hi!
Sorry for the delay, I was away...

On 21 fév, 12:48, Bernhard Schussek <bschus...@gmail.com> wrote:
> --
> Software Architect & Engineer
> Blog:http://webmozarts.com
> Twitter:http://twitter.com/webmozart
>
> 2011/2/21 Brocco <broccola...@gmail.com>:
>
> > The problem is that in the array returned by getValues(), the
> > validator doesn't look at the keys. What is the best way to make this
> > work? Should I create a new getValuesKeys() method that would do a
> > array_keys() of getValues() result ? Or something else?
>
> I usually provide two accessors, for example MyDomain::getGenders()
> and MyDomain::getGenderLabels().

Ok, this works ok!

>
> > ... (data from the post request is a php string) ...
>
> Sounds like a bug. If you pass an array with integer keys to the
> ChoiceField, ChoiceField should return the selected key as integer. I
> will look into this.

Did you have the time to look at it?

>
> > Another point: the default value I put in $myfield is the displayed
> > value ('The value A').
>
> You should set the option key instead. So if the key of the default
> option is 100, you should put $myField = 100 (this is a candidate for
> class constants). This also works with option groups.

Ok, I thought I had tested it before, but in fact no. So it works
great like this, thanks.

Another question related to forms (I don't know if it's the right
place to ask): I can't find an easy way to get access to an uploaded
file from my request object. My code looks like this:
class MyRequest
{
    /**
     * @validation:File(maxSize = "10485760")
     */
    public $myfile;

    public function someFunc() {
         // ...
         return $this->myfile;
    }
}

$this->myfile only contains the temp file path. I would have liked to
get access to a UploadedFile object, but I can't find a way to get it
from MyRequest object. Can you help me?
Thanks

>
> 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 users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to