0

I have two entities. First is Clinic an second is ClinicOpeningHours.

ClinicOpeningHours is mapped by Clinic id, but not in revers. I'm trying to find solution to get whole (7) records (mon - sun) and join it in ClinicFormType to have all this in one form.

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

My form type:

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
                },
            ));
}
cheesemacfly
  • 11,622
  • 11
  • 53
  • 72
Wolly Wombat
  • 99
  • 1
  • 1
  • 9

0 Answers0