Произошла ошибка. Невозможно автосвязать аргумент $besc из 'App'Controller\BescApiController:new() ему нужен экземпляр App\Entity\Besc, но этот тип исключен из config/services.yaml.
Это моя функция new( ) в контроллере
Код: Выделить всё
public function new(Besc $besc, Request $request, ManagerRegistry $managerRegistry, \Twig\Environment $templating, TCPDFController $tcpdf)
{
try {
...
return $besc;
} catch(Exception $e) {
return new JsonResponse(["message" => $e->getMessage(), "flag" => "error"], 401);
}
}
Код: Выделить всё
# 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:
verification_lock_limit : 10
validation_lock_limit : 10
authentication_lock_limit : 10
endpoint_master_data: '%env(MD_BASE_URL)%'
endpoint_partners: '%env(PA_BASE_URL)%'
penalite_soumission_tardive: '%env(PENALITE_SOUMISSION_TARDIVE)%'
zone_afrique_europe: 'afrique - europe'
endpoint_billing: '%env(BILLING_BASE_URL)%'
endpoint_security: '%env(SEC_BASE_URL)%'
deployment_place: '%env(DEPLOYMENT_PLACE)%'
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'
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
App\EventListener\DeserializeListener:
tags:
- {name: 'kernel.event_listener', event: 'kernel.request', method: 'onKernelRequest', priority: 2}
decorates: "api_platform.listener.request.deserialize"
autoconfigure: false
App\EventListener\RequestListener:
tags:
- { name: kernel.event_listener, event: kernel.response, method: onKernelResponse }
# the `qipsius.tcpdf` service will be injected when a
# `Qipsius\TCPDFBundle\Controller\TCPDFController` type-hint is detected
Qipsius\TCPDFBundle\Controller\TCPDFController: '@qipsius.tcpdf'
Я не знаю узнайте, что изменилось, пожалуйста, любая помощь будет оценена
Когда я удалю строку
Код: Выделить всё
- '../src/Entity/'
И мой DeserializeListener.php
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/79184645/cant-autowire-entity-because-type-has-been-excluded[/url]