fos_oauth_server.client_manager.default 未加载
fos_oauth_server.client_manager.default is not loaded
自上周以来,我一直在尝试让 FOS Auth Server Bundle 与
交响乐4。如果我想使用我创建的创建客户端命令,则会出现此错误消息。
The "fos_oauth_server.client_manager.default" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and dependency injection instead.
有没有人遇到同样的问题?
我也遇到了同样的问题。试图注入这样的服务:
<?php
namespace App\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use FOS\OAuthServerBundle\Entity\ClientManager;
class CreateClientCommand extends ContainerAwareCommand
{
protected static $defaultName = 'create:client';
private $client_manager;
public function __construct(ClientManager $client_manager)
{
parent::__construct();
$this->client_manager = $client_manager;
}
但是我得到了错误:
Cannot autowire service "App\Command\CreateClientCommand": argument "$client_manager" of method "__construct()" ref
erences class "FOS\OAuthServerBundle\Entity\ClientManager" but no such service exists. It cannot be auto-registered
because it is from a different root namespace.
所以我在 services.yaml 中注册了我的命令:
App\Command\CreateClientCommand:
arguments:
$client_manager: '@fos_oauth_server.client_manager.default'
现在可以了:)
自上周以来,我一直在尝试让 FOS Auth Server Bundle 与 交响乐4。如果我想使用我创建的创建客户端命令,则会出现此错误消息。
The "fos_oauth_server.client_manager.default" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and dependency injection instead.
有没有人遇到同样的问题?
我也遇到了同样的问题。试图注入这样的服务:
<?php
namespace App\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use FOS\OAuthServerBundle\Entity\ClientManager;
class CreateClientCommand extends ContainerAwareCommand
{
protected static $defaultName = 'create:client';
private $client_manager;
public function __construct(ClientManager $client_manager)
{
parent::__construct();
$this->client_manager = $client_manager;
}
但是我得到了错误:
Cannot autowire service "App\Command\CreateClientCommand": argument "$client_manager" of method "__construct()" ref
erences class "FOS\OAuthServerBundle\Entity\ClientManager" but no such service exists. It cannot be auto-registered
because it is from a different root namespace.
所以我在 services.yaml 中注册了我的命令:
App\Command\CreateClientCommand:
arguments:
$client_manager: '@fos_oauth_server.client_manager.default'
现在可以了:)