Update: I am creating long running background task in Symfony framework using Process functionality. As part of that: - User will complete the form and click submit button - This will start the background process using below script
$rootDir = $this->get('kernel')->getRootDir();
$adk_process = new Process('php ../bin/console app:adkaction ' . $numcampaigns . ', ' . $timezone . ',' . $depdate);
$adk_process->setWorkingDirectory($rootDir);
$adk_process->setTimeout(null);
$adk_process->start();
In order for user to be able to go do other things, we close current session and want to render specific twig tempalate and pass specific variable to it using code below
$ignore_user_abort(true);
$strURL = $rootDir;
header("Location: " . $strURL, false);
header("Connection: close", true);
header("Content-Encoding: none");
header("Content-Length: 0", true);
flush();
ob_flush();
session_write_close();
This works fine however I cannot seem to find the way how to pass a variable this way. My Twig Template is like this
{% if currprogress is defined %}
<div class="col-md-4 col-sm-4 col-xs-12">
<div class="x_panel">
<div class="x_title">
<div class="progress">
<div class="progress-bar progress-bar-striped active"
role="progressbar" aria-valuenow={{currprogress}}
aria-valuemin="0" aria-valuemax="100" style="width:{{currprogress}}%">
Campaign Generation - {{currprogress}}%
</div>
</div>
</div>
</div>
</div>
{% endif %}
So once currprogress variable value is passed to Twig, it would slightly change. Any idea on how to do it using header + link.