I have a database like this
And I need to make a form with checkboxes to save this to this database. Assume these are what my records look like
For now, I have a form like this in which the user can't know witch action corresponds to which function
I'd like something like this where action and function appear together
Does anyone know how to do this?
My PHP code for creating the checkboxes is as follows:
$this->add(array(
'type' => 'DoctrineModule\Form\Element\ObjectMultiCheckbox',
'name' => 'functionAction',
'options' => array(
'label' => 'Functions:',
'object_manager' => $this->getObjectManager(),
'target_class' => 'Acl\Entity\FunctionAction',
'label_generator' => function ($funcAction)
{
return $funcAction->getAction()->getDescription();
},
'is_method' => true,
'find_method' => array(
'name' => 'findByRole',
'params' => array(
'role' => $this->getUser()->getRole()
)
)
)
));
$options = array(
'head_check_callback' => function ($last, $current)
{
return ! $last || $last->getFunction()->getId() != $current->getFunction()->getId();
},
'head_label_callback' => function (\Acl\Entity\FunctionAction $current)
{
$nome = $current->getFunction()->getDescription();
return $current ? $nome : '';
}
);
$this->FormGroupMultiCheckbox()->setOptions($options)->render($this->form->get('functionAction'));