作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
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/
我是一名优秀的程序员,十分优秀!