gpt4 book ai didi

php - 类型错误 : Too few arguments to function

转载 作者:搜寻专家 更新时间:2023-10-31 21:49:22 26 4
gpt4 key购买 nike

services.yml 位于 src/EliteFifa/MatchBundle/Resources/services.yml

parameters:
# repositories
match_repository.class: EliteFifa\MatchBundle\Repository\MatchRepository
match_repository.factory_argument: 'MatchBundle:Match'

# services
match_service.class: EliteFifa\MatchBundle\Service\MatchService

services:
# services
elite_fifa.match_service:
class: %match_service.class%
arguments:
- '@elite_fifa.match_repository'
- '@=service("form.factory")'
- '@elite_fifa.standing_service'

.

class MatchService
{
/**
* @var MatchRepository
*/
private $matchRepository;

/**
* @var FormFactory
*/
private $formFactory;

/**
* @var StandingService
*/
private $standingService;

/**
* @param MatchRepository $matchRepository
* @param FormFactory $formFactory
* @parma StandingService $standingService
*/
public function __construct(
MatchRepository $matchRepository,
FormFactory $formFactory,
StandingService $standingService)
{
$this->matchRepository = $matchRepository;
$this->formFactory = $formFactory;
$this->standingService = $standingService;
}

Symfony 突然停止识别其他参数,我添加了 - '@elite_fifa.standing_servicee' 但出现以下错误:

Type error: Too few arguments to function EliteFifa\MatchBundle\Service\Mat chService::__construct(), 2 passed in /home/owner/Desktop/Workspace/EFL/var /cache/dev/appDevDebugProjectContainer.php on line 1128 and exactly 3 expected

我试过清除缓存,但也没用。

最佳答案

尝试用'@form.factory'替换'@=service("form.factory")'

parameters:
# repositories
match_repository.class: EliteFifa\MatchBundle\Repository\MatchRepository
match_repository.factory_argument: 'MatchBundle:Match'

# services
match_service.class: EliteFifa\MatchBundle\Service\MatchService

services:
# services
elite_fifa.match_service:
class: %match_service.class%
arguments:
- '@elite_fifa.match_repository'
- '@form.factory'
- '@elite_fifa.standing_service'

关于php - 类型错误 : Too few arguments to function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46749928/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com