2015-04-07 62 views
0

我得到這個錯誤在PROD模式(而不是在開發模式實際上):已棄用FOS用戶管理器?

Deprecated: Using the UserManager as user provider is deprecated. 

對於此行:

  // Get the user from the database 
      $user = $this->get('fos_user.user_manager')->loadUserByUsername($username); 

它說,使用FOS\UserBundle\Security\UserProvider,但我怎麼了UserProvider對象使用loadUserByUsername

感謝

+1

使用提供商,而不是經理。 $ user = $ this-> get('fos_user.user_provider') - > loadUserByUsername($ username); – Cerad

+0

我得到這個錯誤:'你要求一個不存在的服務" fos_user.user_provider " ...' – b85411

回答

0

From the documentation

Although the built-in user managers also implement Symfony\Component\Security\Core\User\UserProviderInterface using the UserManager as user provider is deprecated and will trigger an error. Use 'FOS\UserBundle\Security\UserProvider' instead.