Hi,

I would like to make a form where i have a single row, a select box
with ids of my entity Location, where the user can select a single
entry..

The reason for this is that i want to select a id as the general
location id for my website, and then i save the id as the default
location id.

I have tried with a class looking like this:

  public function buildForm(FormBuilder $builder, array $options)
  {
    $builder->add('id','entity',array(
      'class' => 'Club\\UserBundle\\Entity\\Location'
    ));
  }

And my controller like this:

    $em = $this->get('doctrine.orm.entity_manager');
    $location =
$em->find('\Club\UserBundle\Entity\Location',$this->get('session')->get('location_id'));

    $form = $this->get('form.factory')->create(new
\Club\UserBundle\Form\SwitchLocation(), $location);

That gives me the following error:

An exception has been thrown during the rendering of a template ("Expected
argument of type object, integer given") in ::base.html.twig at line 54.

I dont see how to make this dropdown box, can someone help me?

Best regards,
Michael Holm

-- 
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