当我想创建我的自定义post_procesor时,我已经完成了here所说的自定义post_procesor类位于此处src\xyz\SomeBundle\Filter\ImageOptimizer.php
以及if的内容:
<?php
namespace xyz\SomeBundle\Filter\ImageOptimizer;
class TinifyPostProcessor implements PostProcessorInterface
{
....
}
我的app/service
:
services:
app.post_processor.tinify_post_processor:
class: xyz\SomeBundle\Filter\ImageOptimizer\TinifyPostProcessor
tags:
- { name: 'liip_imagine.filter.post_processor', post_processor: 'tinify_post_processor' }
但我收到错误"Attempted to load class "TinifyPostProcessor" from namespace "Galmet\WebBundle\Filter\ImageOptimizer". Did you forget a "use" statement for another namespace?"
,我忘了use
?
答案 0 :(得分:1)
具有完全限定名称的类:
xyz\SomeBundle\Filter\ImageOptimizer\TinifyPostProcessor
应该在档案中:
src\xyz\SomeBundle\Filter\ImageOptimizer\TinifyPostProcessor.php
而不是
src\xyz\SomeBundle\Filter\ImageOptimizer.php