An alias “ScnSocialAuth_ZendSessionManager” was re

2019-08-04 14:01发布

I am trying to install ScnSocialAuth_ZendSessionManager into my zend 2 application. i am getting the following error message when i try to go to the login or registration page:

An alias "ScnSocialAuth_ZendSessionManager" was requested but no service could be found.

i have followed the instructions here:

and uploaded it.

i then install

./vendor/socalnick/scn-social-auth/config/scn-social-auth.global.php.dist
/vendor/socalnick/scn-social-auth/config/scn-social-auth.local.php.dist

to my config.

Then within the scn-social-auth.global.php i did the following:

$settings = array(

    'zend_db_adapter' => 'Zend\Db\Adapter\Adapter',

    'zend_session_manager' => 'Zend\Session\SessionManager'
}
);

return array(
    'scn-social-auth' => $settings,
    'service_manager' => array(
        'aliases' => array(
            'ScnSocialAuth_ZendDbAdapter' => (isset($settings['zend_db_adapter'])) ? $settings['zend_db_adapter']: 'Zend\Db\Adapter\Adapter',
            'ScnSocialAuth_ZendSessionManager' => (isset($settings['zend_session_manager'])) ? $settings['zend_session_manager']: 'Zend\Session\SessionManager',
        ),
    ),
);

i also created a ./config/autoload/session.local.php:

<?php

return array(
    'service_manager' => array(
        'invokables' => array(
            'Zend\Session\SessionManager' => 'Zend\Session\SessionManager',
        ),
    ),
); 

so, i am unclear why i am still getting the error message;

would really appriciate any advise on this.

UPDATE

i also added the module to composer:

"require": {
        "php": ">=5.3.3",
        "zendframework/zendframework": "2.*",
        "socalnick/scn-social-auth": "1.*"
    }

UPATE Wilt has asked what values are returned when i var_dump the config values. the returned values are:

  array (size=3)
          'ScnSocialAuth_ZendDbAdapter' => string 'Zend\Db\Adapter\Adapter' (length=23)
          'ScnSocialAuth_ZendSessionManager' => string 'Zend\Session\SessionManager' (length=27)
          'zfcuser_zend_db_adapter' => string 'Zend\Db\Adapter\Adapter' (length=23)

you will observe that the ScnSocialAuth_ZendSessionManager is aliasing the zend sesssion manager.

so, i am unclear why it say that the service cannot be found.

would really appriciate some advice on this.

1条回答
孤傲高冷的网名
2楼-- · 2019-08-04 14:15

You need the scn-social-auth.global.php and the scn-social-auth.local.php to you application config folder and set all the config parameters that are required.

In this file you find the key 'ScnSocialAuth_ZendSessionManager'. Your issue is probably related to some configuration problem related to these config files.

Since you said you loaded them I would says something is wrong with your autoload setup.

Does your ZF2 application have the proper system configuration:

'module_listener_options' => array(
    'module_paths' => array(
        './module',
        './vendor',
    ),
    'config_glob_paths' => array(
        'config/autoload/{{,*.}global,{,*.}local}.php',
    )
)

Check once if your merged $config array contains all your keys?

$config = $serviceManager->get('Config');
查看更多
登录 后发表回答