Add additional Data to flow
How can I add some inital data to a multi step form flow. I'd like to add the start-time (first call) and the end-time (submit). Any idea how to accomplish that?
There's no built-in solution for this. You would need to save such data manually (but you can use the attached storage).
Hi, I have the same need.
I have a 2 steps form. My last/2nd step is an optional step. I show it only if I find some duplication items in my database.
If there are, I ask the user if he/she really wants to add the new prescriber or not.
So, I use the skip parameter in my FormFlow class like this :
array(
'label' => 'Confirmation',
'skip' => function($estimatedCurrentStepNumber, FormFlowInterface $flow) use (&$em) {
$rp = $em->getRepository('AppBundle:Prescriber');
# search if a prescriber already exists
$qb = $rp->createQueryBuilder('p');
$qb->where($qb->expr()->eq('p.rpps', ':rpps'))
->setParameter('rpps', $flow->getFormData()->getRpps());
$results = $qb->getQuery()->getResult();
return ($estimatedCurrentStepNumber > 1 && empty($results)) ? true : false;
}
)
But I don't know how to display in this step all the duplication items I found ($results).
I thought to add a form_options parameter and serialize my doubloons in an HiddenType field...
Is there a way to do it differently ? Maybe in the Controller action ?