0

我有两个实体。第Clinic一个是第二个ClinicOpeningHours

ClinicOpeningHoursClinicid 映射,但不是反向映射。我正在尝试找到解决方案来获取全部(7)条记录(周一 - 周日)并将其加入ClinicFormType以将所有这些都以一种形式。

$clinic = $em->getRepository('MyEntity:Clinic')->findOneBy(array(etc));
$form = $this->createForm(new ClinicFormType(), $clinic);

我的表格类型:

public function buildForm(FormBuilderInterface $builder, array $options) {
    $builder->add('name', 'text', array('label' => 'Name'));
    $builder->add('services', 'entity', array(
                'class' => 'MyEntity:Service',
                'property' => 'name',
                'label' => 'Services',
                'required' => false,
                'multiple' => true,
                'attr' => array(
                    'data-placeholder' => "Choose one...",
                    'multiple' => 'multiple',
                    'class' => "chzn-select"
                )
            ))
            ->add('WEEK DAYS', 'entity', array(
                'label' => 'Property Language',
                'class' => 'MyEntity:ClinicOpeningHours',
                'query_builder' => SEVER RECORDS FROM DB MAPPED BY ID
                },
            ));
}
4

0 回答 0