[英]how to fix this error "App\Controller\CoreController" has no container set, did you forget to define it as a service subscriber?
i was deconnected any times at my application so i've want fix the problem but i've this error ans my folders / services was correctly configured.我在我的应用程序中任何时候都断开连接,所以我想解决这个问题,但我有这个错误,我的文件夹/服务配置正确。 I would like to know if anyone has ever encountered this problem and if so how to fix it.
我想知道是否有人遇到过这个问题,如果遇到过如何解决。
Services.yaml服务.yaml
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
App\Controller\:
resource: '../src/Controller'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
CoreController核心控制器
namespace App\Controller;
use App\Entity\Intervention;
use Doctrine\ORM\Mapping\Id;
use Doctrine\DBAL\Schema\Index;
use App\Repository\OperateurRepository;
use Doctrine\Persistence\ManagerRegistry;
use App\Repository\InterventionRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class CoreController extends AbstractController
{```
I've fix with我已经修复了
calls:
- [setContainer, ["@service_container"]]
in services.yaml在服务.yaml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.