public function autoloadTypes()
    {
        //loaded and static
        if (self::$loaded) {
            return;
        }

        if (!$this->kernel->isDebug() && $this->loadFromCacheCache()) {
            self::$loaded = true;

            return;
        }

        self::$loaded = true;

        foreach ($this->kernel->getBundles() as $bundle) {
            $path = $bundle->getPath().'/Type';
            if (file_exists($path)) {
                $this->registerBundleTypes($path, $bundle->getNamespace());
            }
        }

        if (Kernel::VERSION_ID >= 40000) {
            $path = $this->kernel->getRootDir().'/Type';
            if (file_exists($path)) {
                $this->registerBundleTypes($path, 'App');
            }
        }

        $this->saveCache();
    }