I have recently started using Symfony. I write a doctrine query and i found the values I needed but i have the problem when i want to enter values in a form's textbox with a for loop.. This is my query:
$id_user = $user->getId();
$query = $em->createQueryBuilder()
->select('ur','uu')
->from('DtEcBundle:UserReferences', 'ur')
->innerJoin("ur.id_user","uu")
->where("ur.id_user = :id_user")
->setParameter("id_user",$id_user)
->getQuery();
$userpyramid = $query->getResult();
And now i would insert my values in a form..
$form = $this->get('form.factory')->createNamedBuilder('form', 'form')
->setMethod('POST')
->setAction($this->generateUrl('profilo_secondlevel'))
->add('idreferenced', 'text', array(
'data' => '',
))
->add('save', 'submit', ['label' => 'Prova'])
->getForm();