0
1つの予定を作成するには、1人の患者を選択する必要があります。 選択リストでは、患者の名前と年齢を表示する必要があります。選択フィールド形式の2つのフィールドSymfony2
コード:
class AppointmentType extends AbstractType{
public function buildForm(FormBuilder $builder, array $options)
{
$builder->add('id', 'entity', array('class'=>'ProjectAppointmentBundle:Patient',
'label'=>'Patient '
));
}
public function getName()
{
return 'patient';
}
}
と作用:働いているが、
public function newAction()
{
...
$patient = new Patient();
$entity = new Appointment($patient);
$form = $this->createForm(new AppointmentType(), $entity);
return array(
'entity' => $entity,
'form' => $form->createView()
);
}
は、患者の名前のみを表示(_toString()メソッドは、患者の名前を返します)。 私は選択フィールドに患者の名前と年齢を表示する必要があります。
エンティティの患者は、ID、名前、年齢、住所などを持っている...
誰かが私を助けることができますか?
ありがとうございます!働いた! = D – Munir
あなたは大歓迎です。あなたがSonataAdminBundleを使用するまで待ってください - 非常によく文書化されていません! – user1207727