0
votes

i setup form createFormBuilder

 $form = $this->createFormBuilder($ob)

        ->add('mkeywordsId', 'entity',['label'=>'rodzaj','class' => 'Miejsce\ObiektyBundle\Entity\Mkeywords'])

and this select dont have curent option selected, how to do this? when i put ->add('mkeywordsId', 'text') i see text witch 1445 value , and this key exists in Mkeywords select list so why is not selected ?

I have only mapping from Mmiejsce, mkeywords dont have mappings because is not only one entity use keywords. In this situation Mmiejsce have connection one Mmiejsce to one Mkeyword.

Maybe i can map in createFormBuilder->add ? Mmiejsce.mkeywordsId = Mkeywords.id and want get Mkeywords.name

class Mmiejsce

/**
 * Rodzaj
 * @ORM\ManyToOne(targetEntity="Mkeywords")
 * @ORM\JoinColumn(name="keyword_id", referencedColumnName="id")
 * @var integer
 */
private $mkeywordsId;
}



class Mkeywords
{
/**
 * @var string
 */
private $name;

/**
 * @var integer
 */
private $mkeywordsId;
1

1 Answers

0
votes

Sounds like the relationships between your entities are not mapped correctly. Can you post the contents/schema of the entity class for this form?