This has been bugging me for a week now.
I cant seem to get a large php array to persist in the session over a page redirect.
for ($i=1;$i<$data['weeks'];$i++) {
$instances[] = array(
'start' => $startTime + ((86400 * 7) * $i),
'end' => $startTime + ((86400 * 7) * $i) + $duration,
'venueId' => $data['venueId']
);
}
$request->getSession()->set('addClass-1-instances', $instances);
return new RedirectResponse ($this->generateUrl(
'class_add', array(
'clubId' => $this->club->clubId,
'step' => 4,
'classType' => 1
)
));
This works when the array is really small (1-10 elements) but fails when it is larger (1000 - 2000 elements).
If I dump out the session object after adding it, I can see that it is in the session attributes collection.
var_dump($request->getSession());
protected 'attributes' => &
array (size=6)
'addClass-1-instances' =>
array (size=1560)
0 => ...
But once the page is redirected, the session appears to be totally empty.
object(Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag)[487]
private 'name' => string 'attributes' (length=10)
private 'storageKey' => string '_sf2_attributes' (length=15)
protected 'attributes' => &
array (size=0)
empty
We store our sessions in the database, and it works fine throughout the rest of the webapp. I've read all over the place and seen people talk about the session.save-dir php option, but am I not right to think this is irrelevant when using DB storage.
Help!
Not sure how to solve this. The session ids remain the same on both the pages, and theres no code that explicitly clears the session.
Not sure where to go not but here!