doctrine2 - Symfony 2 form checkbox checked based on entity data? -
ok have built form type accounts entity , within have entity type field panels account entitled have, following works,
$results = $options['data']->getresellerpanelops()->toarray(); <- data from! ->add('panels', 'entity', ['label' => 'panels', 'class' => 'bundle:panels', 'choice_label' => 'panels.title', 'multiple' => true, 'expanded' => true, 'required' => false, 'mapped' => false, 'attr' => ['class' => 'panels'], 'query_builder' => function(entityrepository $er) use ($results) { return $er->createquerybuilder('s') ->where("s.id in (:ids)") ->setparameter('ids', $results); } ]); so lists panels has checkboxes account has, when there no panels added account, displays nothing.
what want display panels preset array (or entity lists them all). not sure how that? preset data panel_details , list of user has access held within panels
the way thinking change class of panels panel_details, choice_label wrong, not sure how execute change?
i think have explained myself right in question please point out if not make sense.
all welcome.
many thanks
Comments
Post a Comment