public final function connect()
 {
     if ($this->_connected) {
         return;
     }
     if ($this->_clear_cache_on_connected) {
         include_once libfile('function_cache', 'function');
         updatecache(array('plugin', 'setting', 'styles'));
         cleartemplatecache();
         cleartemplatecache();
     }
     /**
      * @var $security_context \Symfony\Component\Security\Core\SecurityContext
      */
     $security_context = $this->_container->get('security.context');
     global $_G;
     if (isset($_G['uid']) && $_G['uid'] > 0 && $_G['uid'] < 0x7fffffff) {
         $em = $this->_container->get('doctrine')->getManager();
         /**
          * @var $user \Symforce\DiscuzBundle\Entity\User
          */
         $user = $em->getRepository('Symforce\\DiscuzBundle\\Entity\\User')->find($_G['uid']);
         if (!$user) {
             throw new \Exception(sprintf('user(id=%s) not exists!', $_G['uid']));
         }
         $user->setupDiscuzRoles($em, $_G);
         $token = new \Symforce\DiscuzBundle\Security\Authentication\Token\UserToken();
         $token->setUser($user);
         $token->setUserId($user->getId());
         $security_context->setToken($token);
     }
     $request = \Dev::getRequest();
     if ($request->query->has('debug') && 0) {
         /**
          * @var $http_kernel \Symfony\Component\HttpKernel\HttpKernel
          */
         $http_kernel = $this->_container->get('http_kernel');
         $event = new \Symfony\Component\HttpKernel\Event\GetResponseEvent($http_kernel, $request, \Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST);
         $rc = new \ReflectionObject($http_kernel);
         $rp = $rc->getProperty('dispatcher');
         $rp->setAccessible(true);
         /**
          * @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface
          */
         $dispatcher = $rp->getValue($http_kernel);
         $dispatcher->dispatch(\Symfony\Component\HttpKernel\KernelEvents::REQUEST, $event);
     }
     if ($this->_container->getParameter('kernel.debug')) {
         if ($request->query->has('debug_dump')) {
             $debug = $request->query->get('debug_dump');
             if (strrpos($debug, '[') !== false) {
                 $accessor = new \Symfony\Component\PropertyAccess\PropertyAccessor(false, true);
                 $value = $accessor->getValue($GLOBALS, $debug);
                 \Dev::dump($value);
                 exit;
             }
         }
     }
     /**
      * @var $plugin_module PluginModule
      */
     foreach ($this->_modules as $plugin_module) {
         $plugin_module->connect();
     }
     $this->_connected = true;
 }