我正在尝试将Parameters.yml文件中的googleApiKey绑定到我的geoLocationService,但它一直在说:
Cannot autowire service "CoreBundle\Service\GeoLocationService": argument "$googleApiKey" of method "__construct()" is type-hinted "string", you should configure its value explicitly.
我尝试了许多通过搜索找到的配置变体,但没有任何效果。
GeoLocationService
public function __construct(EntityManager $entityManager, string $googleApiKey)
Service.yml
CoreBundle\Service\GeoLocationService:
arguments:
$googleApiKey: '%google_api_key%'