2012-12-20 148 views
-1

創建服務我創建了一個自定義的用戶類具有自定義userProvider基於following link爲用戶提供

我無法爲用戶創造提供商的服務。

$app->setParameter(
    'webservice_user_provider.class', 
    'Tac\WebserviceUserBundle\Security\User\WebserviceUserProvider' 
); 
$app->setDefinition(
    'webservice_user_provider', 
    new Definition('%webservice_user_provider.class%') 
); 

Fatal error: Call to undefined method Silex\Application::setParameter() in http://content.api.com/Users/davyd/Sites/content_api/src/boot.php on line 119

回答

2

Silex的不是Symfony2的框架,所以Symfony2中的文檔不適用。

查看關於如何在Silex中定義服務的文檔,請看http://silex.sensiolabs.org/doc/services.html

$app['some_service'] = $app->share(function() { 
    return new Service(); 
}); 
+2

Symfony2的文檔不會總是適用。組件文檔實際上可以應用。只是框架部分沒有。 – igorw

相關問題