我正在尝试将FilterService
注入到构造函数中,以便能够调用getUrlOfFilteredImage
。
但是,出现以下错误:
Cannot autowire service "App\Bll\PhotoService": argument "$filterService" of method "__construct()" references class "Liip\ImagineBundle\Service\FilterService" but no such service exists. You should maybe alias this class to the existing "liip_imagine.service.filter" service.
如何为该类添加别名,以便可以注入服务?
我也尝试了使用container->get(...)
的旧方法,但是container为null,我不确定这是否也是正确的方法。
答案 0 :(得分:0)
一种解决方案应该是将类添加到config / services.yaml
services:
Liip\ImagineBundle\Service\FilterService:
# some settings