public function setAuthenticated($state) { parent::setAuthenticated($state); if ($state === FALSE) { return; } if (($identity = $this->getIdentity()) instanceof UserEntity) { $loginEntity = $this->loginRepository->createNew(array($this->session->id, $identity)); $this->loginRepository->save($loginEntity); } else { if ($this->checkConnection->invoke()) { $loginEntity = $this->loginRepository->createNew(array($this->session->id, NULL)); $this->loginRepository->save($loginEntity); } } }