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
Post a Comment