I've got another problem with symfony 2.
Here is my DB schema:

Now, the problem.
When i m creating form in TranslationController:addAction() to create new translation, i can choose languages from lang table and strings from string table. That would be ok. Problem is, i need chose only languages that project have and only strings that are connected to this translation with string id.
I have TranslationController:addAction() like this:
/**
* @Route("/project/{project_id}/string/{string_id}/translation/add/")
* @Template()
*/
public function addAction(Request $request)
{
$translation = new Translation();
$translation->setCreatedBy('Vytvoril: ')
->setCorrectedBy('Koregoval: ')
->setText('Preklad: ')
->setNote('Poznámka');
$form = $this->createFormBuilder($translation)
->add('createdBy', 'text')
->add('correctedBy', 'text')
->add('Text', 'text')
->add('note', 'text')
->add('lang', 'entity', array(
'class' => 'DomestosTranslatingBundle:Lang',
'expanded' => false,
'multiple' => false,
'property' => 'code',
))
->add('string', 'entity', array(
'class' => 'DomestosTranslatingBundle:String',
'expanded' => false,
'multiple' => false,
'property' => 'code',
))
->add('save', 'submit')
->getForm();
$form->handleRequest($request);
if($form->isSubmitted())
{
$em = $this->getDoctrine()->getManager();
$em->persist($translation);
$em->flush();
}
return $this->render('DomestosTranslatingBundle:Translation:add.html.twig', array(
'form' => $form->createView(),
));
}
But this code allows me to chose every language that has been created in lang and also every string that is in String table, not only those connected.
Thanks for any help.