Saturday, 15 May 2010

Symfony2, ajax, closed session, outdated entity -



Symfony2, ajax, closed session, outdated entity -

let's phone call controller via ajax , do:

$session = $this->get('session'); $session->save(); session_write_close();

at origin of it. if have

sleep(10) $someentityfromdatabase->getsomevalue();

and value might alter within timeframe of sleep() since controller got called, still receive old value, e.g. 0 , not real current value.

what did miss?

regards

edit:

user calls controller via ajax. need close phone call session_write_close(), user can other stuff while controller working. controller calls function x after let's 10 seconds. this function checks value in database.

the value can alter within timeframe of 10 seconds. 0 when initial controller got called, within 10 seconds got changed f.e. 4. if function checking value, still 0 instead of 4.

regards

your question isn't clear, if understand correctly controller calling ajax updates entity, it's along lines of

sleep(10) $someentityfromdatabase = $this->getdoctrine()->getmanager('acme:bundle:entity')->findoneby(...); $someentityfromdatabase->getsomevalue();

symfony2 entity sleep

No comments:

Post a Comment