我的 buildForm 类如下所示。
$builder->add('icon','entity',
array(
'class' => 'UserBundle:IconPics',
'property' => 'label', // .. or whatever property the image location is stored.
'expanded' => true,
'multiple' => false,
'label' => 'form.icon', 'translation_domain' => 'FOSUserBundle',
'query_builder' => function ($repository) {
return $repository->createQueryBuilder('i')
->add('where', 'i.enabled = true');
}
));
如何设置此单选按钮的默认值?
根据彼得贝利的回答
use Acme\UserBundle\Entity\IconPics;
//
$IconPics = new IconPics();
// howw can I select the target Icon?????