I have the following code that works:
//AdminController.php
$orders_repo=$em->getRepository("BackendBundle:Orders");
$order=$orders_repo->getQuery()->getResult();
$form = $this->createForm(OrderType::class, $order);
And in the OrderType form this code:
$builder
->add('customername', TextType::class, array(
'label'=>'Numero de Causa',
'required'=>'Requerido',
'attr'=> array (
'class' => 'form-name form-control'
)
));
The problem is when you want to show a more elaborate query to show in the form.
Something like this:
$query = $em->createQuery(
'SELECT u, o
FROM BackendBundle:Orders o
JOIN o.users u
where o.orderid = :orderid'
)->setParameter('orderid', $id);
$order = $query->getResult();
$form = $this->createForm(OrderType::class, $order);
If you want to show this in the form and then update how it can be done?