```
$builder
  ->add('tecnicoId', 'entity', array(
  'class'       => 'MainHomeBundle:Tecnicos',
  'property'    => 'nombre',
  'expanded' => false,
  'multiple' => false
 ))
->add('cambiar', 'submit')
;

```

**controller**

```
$form = $this->createForm(new ServicioseditType(), $datos);
$form->handleRequest($request);

$em = $this->getDoctrine()->getManager();
$em->flush();

return $this->render('MainHomeBundle:Admin:editserv.html.twig', array("form"=>$form->createView()));

```

**view twig**

```
{{ form_errors(form.tecnicoId) }}
{{ form_widget(form.tecnicoId) }}
{{ form_widget(form.cambiar, { 'attr': {'class': 'boton'} }) }}

```

**when I click to make the update get the following error**

> 
> ContextErrorException: Catchable Fatal Error: Object of class
>  Main\HomeBundle\Entity\Tecnicos could not be converted to string in
>  C:\xampp\htdocs\digitalfix\vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php
>  line 784
> 
> 
> 

**when I see the detail of sql, I see the value of tecnico\_id is empty**

> 
> An exception occurred while executing 'UPDATE servicios SET tecnico\_id
>  = ? WHERE id = ?' with params [{}, 1]:
> 
> 
> 

**the technical entity is a string name**

```
class Tecnicos
{

    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string
     * 
     * @Assert\NotBlank()
     * @Assert\Length(
     * min = 8,
     * max = 55,
     * minMessage = "{{ limit }} caracteres minimo",
     * maxMessage = "{{ limit }} caracteres maximo"
     * )
     *
     * @ORM\Column(name="nombre", type="string", length=55, nullable=false)
     */
    private $nombre;

    public function __toString()
    {
        return $this->nombre;
    }

```

**the service entity is an integer because only the technical id no name is inserted .**

```
class Servicios
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var integer
     *
     * @ORM\Column(name="cliente_id", type="integer", nullable=false)
     */
    private $clienteId;

    /**
     * @var integer
     *
     * @ORM\Column(name="tecnico_id", type="integer", nullable=true)
     */
    private $tecnicoId = 1;

```