php - Symfony Session Initialization -


currently, when needed, i'm initializing session following code:

if (!$request->hassession()) {     $this->logger->debug("starting new session");     $session = new session();     $session->start();     $request->setsession($session); } 

is there simple way initialize session when needed?

i thinking $request->getsession(true) in order create if not existing. or listener create session @ beginning of each request.

is there alternative or practice?

actually if want meddle session should see session management docs.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -