我正在尝试将现有的Symfony 2.8网站升级到3.4。
我已经面对并解决了许多问题,但是我遇到了Geoplugin问题。
我已经按照以下AppBundle/Resources/config/services.yml
进行了更新,以遵守新的YAML指令(因此我在@variables周围添加了“”):
app.ipgeo:
class: AppBundle\Utils\Geo\Geoplugin
arguments: ['@request', '@doctrine.orm.entity_manager', '@service_container']
scope: request
tags:
- { name: kernel.event_listener, event: kernel.controller, method: onLoad }
但是访问网站时出现PHP致命错误:
AH01071: Got error 'PHP message: PHP Fatal error: Call to a member function getUri() on string in /var/www/vhosts/alpclic-dev.fr/httpdocs/dev.scenes-locales.com/src/AppBundle/Utils/Geo/Geoplugin.php on line 58
PHP message: PHP Fatal error: Call to a member function getUri() on string in
/var/www/vhosts/alpclic-dev.fr/httpdocs/dev.scenes-locales.com/src/AppBundle/Utils/Geo/Geoplugin.php
on line 58\n'
有什么想法吗?
当然,它在2.8中使用以下配置可以完美运行:
app.ipgeo:
class: AppBundle\Utils\Geo\Geoplugin
arguments: [@request, @doctrine.orm.entity_manager, @service_container]
scope: request
tags:
- { name: kernel.event_listener, event: kernel.controller, method: onLoad }
答案 0 :(得分:0)
不太容易且“不言自明”!
我不得不迁移到此处提到的'request_stack'服务:How to inject the @request into a service?