Neos\Flow\Session\TransientSession::getId PHP Method

getId() public method

Returns the current session ID.
public getId ( ) : string
return string The current session ID
    public function getId()
    {
        if ($this->started !== true) {
            throw new Exception\SessionNotStartedException('The session has not been started yet.', 1218034659);
        }
        return $this->sessionId;
    }

Usage Example

 /**
  * Proofs correct logging behaviour without argument reason given
  *
  * @test
  */
 public function logDestroyDoesNotRequireArgumentReason()
 {
     $testSession = new TransientSession();
     $testSession->start();
     $testSessionId = $testSession->getId();
     $mockJoinPoint = new JoinPoint($testSession, TransientSession::class, 'destroy', []);
     $mockSystemLogger = $this->createMock(SystemLoggerInterface::class);
     $mockSystemLogger->expects($this->once())->method('log')->with($this->equalTo('TransientSession: Destroyed session with id ' . $testSessionId . ': no reason given'));
     $loggingAspect = new LoggingAspect();
     $this->inject($loggingAspect, 'systemLogger', $mockSystemLogger);
     $loggingAspect->logDestroy($mockJoinPoint);
 }
All Usage Examples Of Neos\Flow\Session\TransientSession::getId