只是在从 ZF2 迁移到 ZF3 的过程中,并试图将 HTMLPurifier 作为过滤器加入。
这里的文章介绍了如何给FilterPluginManager添加过滤器 https://zendframework.github.io/zend-filter/writing-filters/
我以为我已经完成了必要的工作: https ://github.com/Saeven/Purifier/blob/master/src/Soflomo/Purifier/Module.php
尝试使用过滤器时,工厂按预期调用: https ://github.com/Saeven/Purifier/blob/master/src/Soflomo/Purifier/Factory/Filter/PurifierFilterFactory.php#L14
但是,当它尝试 ->get('HTMLPurifierEngine') 并出现以下错误时,工厂会死掉:
未捕获的 Zend\ServiceManager\Exception\ServiceNotFoundException:无法将服务“HTMLPurifierEngine”解析为工厂;你确定你在配置过程中提供了它吗?在 /Users/Saeven/Documents/Circlical/code/Cloudshare/vendor/zendframework/zend-servicemanager/src/ServiceManager.php:675
有趣的是,这个服务肯定是在这里定义的: https ://github.com/Saeven/Purifier/blob/master/config/module.config.php#L20
我一定遗漏了一些明显的东西。可能是盯着看太久了……
您知道如何配置模块以避免此错误吗?为什么服务对容器不可见?
谢谢!