我在我的应用程序中使用多个用户提供程序:
security:
providers:
chain_provider:
chain:
providers: [entity, json]
entity:
id: myapp.entity.user_provider
json:
id: myapp.json.user_provider
现在我需要从服务加载用户
services:
myapp.my.service:
class: AppBundle\Services\My
argument: [@the.defined.chain.provider]
// AppBundle\Services\My
namespace AppBundle\Services;
class My
{
public function loadUser($username)
{
return $this->userProvider->loadUserByUsername($username);
}
}
如何明确使用链提供者?