Hi,

I'm trying to implement a simple search form, and I want to store the search
criterias in session to get them back later. I have 2 fields:
- a textfied "title"
- a choicefield "category"

In session, I store an array of values, for instance array('category' => 2,
'title' => 'foo').

The main issue comes when I want to instanciate the form with the search
criterias, I have this exception: "Warning: spl_object_hash() expects
parameter 1 to be object, integer given". This error is thrown by the
EntityToIDTransformer class.

To fix that, I've to tranform the "category" values into a persisted entity,
using Doctrine to fetch the data:
$data['category'] = $em
        ->getRepository('BlogBundle:Category')
        ->find($data['category_id']);

And then, it works. Is there a better way, or is it the right way to do
that?

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