Symfony:没有扩展能够加载“服务”的配置

时间:2017-02-05 14:04:45

标签: php symfony

我试图让Google在我的网站上登录,使用它 HWIOAuthBundle

在我的网站上收到此错误:

ClassNotFoundException in AppKernel.php line 17:

Attempted to load class "FOSUserBundle" from namespace "FOS\UserBundle". Did you forget a "use" statement for another namespace?

我认为我的捆绑包是正确的:

    $bundles = array(

        new FOS\UserBundle\FOSUserBundle(),
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
        new Symfony\Bundle\TwigBundle\TwigBundle(),
        new Symfony\Bundle\MonologBundle\MonologBundle(),
        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
        new Symfony\Bundle\AsseticBundle\AsseticBundle(),
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
        new HWI\Bundle\OAuthBundle\HWIOAuthBundle()

    );

当尝试清除缓存时,出现此错误,我认为这是我的问题:

enter image description here

我的services.yml文件:

service: my.oauth_aware.user_provider.service: class: HWI\Bundle\OAuthBundle\Security\Core\User\FOSUBUserProvider arguments: userManager: "@fos_user.user_manager" properties: ["pass properties as array"]

Configuration.php中的默认方法:

public function getConfigTreeBuilder()
{
    $treeBuilder = new TreeBuilder();
    $rootNode = $treeBuilder->root('fos_user');
    $supportedDrivers = array('orm', 'mongodb', 'couchdb', 'custom');
    $rootNode
        ->children()
        ->scalarNode('db_driver')
        ->validate()
        ->ifNotInArray($supportedDrivers)
        ->thenInvalid('The driver %s is not supported. Please choose one of '.json_encode($supportedDrivers))
        ->end()
        ->cannotBeOverwritten()
        ->isRequired()
        ->cannotBeEmpty()
        ->end()
        ->scalarNode('user_class')->isRequired()->cannotBeEmpty()->end()
        ->scalarNode('firewall_name')->isRequired()->cannotBeEmpty()->end()
        ->scalarNode('model_manager_name')->defaultNull()->end()
        ->booleanNode('use_authentication_listener')->defaultTrue()->end()
        ->booleanNode('use_listener')->defaultTrue()->end()
        ->booleanNode('use_flash_notifications')->defaultTrue()->end()
        ->booleanNode('use_username_form_type')->defaultTrue()->end()
        ->arrayNode('from_email')
        ->addDefaultsIfNotSet()
        ->children()
        ->scalarNode('address')->defaultValue('webmaster@example.com')->cannotBeEmpty()->end()
        ->scalarNode('sender_name')->defaultValue('webmaster')->cannotBeEmpty()->end()
        ->end()
        ->end()
        ->end()
        // Using the custom driver requires changing the manager services
        ->validate()
        ->ifTrue(function ($v) {
            return 'custom' === $v['db_driver'] && 'fos_user.user_manager.default' === $v['service']['user_manager'];
        })
        ->thenInvalid('You need to specify your own user manager service when using the "custom" driver.')
        ->end()
        ->validate()
        ->ifTrue(function ($v) {
            return 'custom' === $v['db_driver'] && !empty($v['group']) && 'fos_user.group_manager.default' === $v['group']['group_manager'];
        })
        ->thenInvalid('You need to specify your own group manager service when using the "custom" driver.')
        ->end();
    $this->addProfileSection($rootNode);
    $this->addChangePasswordSection($rootNode);
    $this->addRegistrationSection($rootNode);
    $this->addResettingSection($rootNode);
    $this->addServiceSection($rootNode);
    $this->addGroupSection($rootNode);
    return $treeBuilder;
}

0 个答案:

没有答案