Php sulu扩展页面文档

Php sulu扩展页面文档,php,sulu,Php,Sulu,我正在尝试扩展PageDocument类。我将以下设置添加到我的app/config/config.yml sulu_document_manager: mapping: page: class: Client\Bundle\WebsiteBundle\Document\PageDocument phpcr_type: sulu:page 类Client\Bundle\WebsiteBundle\Document\Page

我正在尝试扩展PageDocument类。我将以下设置添加到我的
app/config/config.yml

sulu_document_manager:
    mapping:
        page:
            class: Client\Bundle\WebsiteBundle\Document\PageDocument
            phpcr_type: sulu:page
Client\Bundle\WebsiteBundle\Document\PageDocument
只是扩展了类
Sulu\Bundle\ContentBundle\Document\PageDocument

namespace Client\Bundle\WebsiteBundle\Document;

use Sulu\Bundle\ContentBundle\Document\PageDocument as BasePageDocument;

class PageDocument extends BasePageDocument
{
}
在前端打开页面可以工作,但在后端编辑页面会在预览区域显示以下错误消息:

Metadata with class "Sulu\Bundle\ContentBundle\Document\PageDocument" 
not found, known classes: "Client\Bundle\WebsiteBundle\Document
\PageDocument", "Sulu\Bundle\ContentBundle\Document\HomeDocument", 
"Sulu\Bundle\ContentBundle\Document\RouteDocument", "Sulu\Bundle
\SnippetBundle\Document\SnippetDocument", "Client\Bundle\WebsiteBundle
\Document\RegionDocument" 

500 Internal Server Error - MetadataNotFoundException 
堆栈跟踪

1. in vendor/sulu/document-manager/lib/Metadata/BaseMetadataFactory.php at line 132  -

//echo '<pre>$class: '; var_dump($class); echo '</pre>';
    if (!isset($this->classMap[$class])) {
        throw new MetadataNotFoundException(sprintf(
            'Metadata with class "%s" not found, known classes: "%s"',
                $class, implode('", "', array_keys($this->classMap))
        ));

2. at BaseMetadataFactory ->getMetadataForClass ('Sulu\Bundle\ContentBundle\Document\PageDocument')
in vendor/sulu/document-manager/lib/Metadata/MetadataFactory.php at line 78  +
3. at MetadataFactory ->getMetadataForClass ('Sulu\Bundle\ContentBundle\Document\PageDocument')
in vendor/sulu/sulu/src/Sulu/Bundle/DocumentManagerBundle/Bridge/DocumentInspector.php at line 125  +
4. at DocumentInspector ->getMetadata (object(PageDocument))
in vendor/sulu/sulu/src/Sulu/Bundle/DocumentManagerBundle/Bridge/DocumentInspector.php at line 111  +
5. at DocumentInspector ->getStructureMetadata (object(PageDocument))
in vendor/sulu/sulu/src/Sulu/Bundle/DocumentManagerBundle/Bridge/DocumentInspector.php at line 262  +
6. at DocumentInspector ->getLocalizedUrlsForPage (object(PageDocument))
in vendor/sulu/sulu/src/Sulu/Component/Content/Compat/Structure/PageBridge.php at line 35  +
7. at PageBridge ->getUrls ()
in vendor/sulu/sulu/src/Sulu/Bundle/WebsiteBundle/Resolver/StructureResolver.php at line 65  +
8. at StructureResolver ->resolve (object(PageBridge))
in vendor/sulu/sulu/src/Sulu/Bundle/WebsiteBundle/Resolver/ParameterResolver.php at line 57  +
9. at ParameterResolver ->resolve (array(), object(AdminRequestAnalyzer), object(PageBridge), true)
in vendor/sulu/sulu/src/Sulu/Bundle/WebsiteBundle/Controller/WebsiteController.php at line 84  +
10. at WebsiteController ->getAttributes (array(), object(PageBridge), true)
in vendor/sulu/sulu/src/Sulu/Bundle/WebsiteBundle/Controller/WebsiteController.php at line 46  +
11. at WebsiteController ->renderStructure (object(PageBridge), array(), true, false)
in vendor/sulu/sulu/src/Sulu/Bundle/WebsiteBundle/Controller/DefaultController.php at line 41  +
12. at DefaultController ->indexAction (object(PageBridge), true, false)
in vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/Preview/PreviewRenderer.php at line 92  +
13. at PreviewRenderer ->render (object(PageBridge), false)
in vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/Preview/Preview.php at line 223  +
14. at Preview ->renderStructure (object(PageBridge), false, null)
in vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/Preview/Preview.php at line 212  +
15. at Preview ->render ('1', '8a7d4c4a-60b4-4ced-9b3b-007e238810ff', 'sulu_io', 'en')
in vendor/sulu/sulu/src/Sulu/Bundle/ContentBundle/Controller/PreviewController.php at line 57  +
16. at PreviewController ->renderAction (object(Request), '8a7d4c4a-60b4-4ced-9b3b-007e238810ff')
17. at call_user_func_array (array(object(PreviewController), 'renderAction'), array(object(Request), '8a7d4c4a-60b4-4ced-9b3b-007e238810ff'))
in app/bootstrap.php.cache at line 3054  +
18. at HttpKernel ->handleRaw (object(Request), '1')
in app/bootstrap.php.cache at line 3016  +
19. at HttpKernel ->handle (object(Request), '1', true)
in app/bootstrap.php.cache at line 3165  +
20. at ContainerAwareHttpKernel ->handle (object(Request), '1', true)
in app/bootstrap.php.cache at line 2406  +
21. at Kernel ->handle (object(Request))
in web/admin.php at line 44  +
1。在第132行的vendor/sulu/document manager/lib/Metadata/BaseMetadataFactory.php中-
//回显“$class:”;var_dump($class);回声';
如果(!isset($this->classMap[$class])){
抛出新的MetadataNotFoundException(sprintf(
未找到类为“%s”的元数据,已知类为“%s”,
$class,内爆(“,”,数组_键($this->classMap))
));
2.在BaseMataFactory->getMetadataForClass('Sulu\Bundle\ContentBundle\Document\PageDocument')上
在第78行的vendor/sulu/document manager/lib/Metadata/MetadataFactory.php中+
3.在MetadataFactory->getMetadataForClass('Sulu\Bundle\ContentBundle\Document\PageDocument')
在第125行的vendor/sulu/sulu/src/sulu/Bundle/DocumentManagerBundle/Bridge/DocumentInspector.php中+
4.在DocumentInspector->getMetadata(对象(PageDocument))
在第111行的vendor/sulu/sulu/src/sulu/Bundle/DocumentManagerBundle/Bridge/DocumentInspector.php中+
5.在DocumentInspector->GetStructureMatadata(对象(PageDocument))
在第262行的vendor/sulu/sulu/src/sulu/Bundle/DocumentManagerBundle/Bridge/DocumentInspector.php中+
6.在DocumentInspector->getLocalizedUrlsForPage(对象(PageDocument))
在第35行的vendor/sulu/sulu/src/sulu/Component/Content/Compat/Structure/PageBridge.php中+
7.在PageBridge->getUrls()
在第65行的vendor/sulu/sulu/src/sulu/Bundle/WebsiteBundle/Resolver/structuresolver.php中+
8.在结构解析程序->解析(对象(PageBridge))
在第57行的vendor/sulu/sulu/src/sulu/Bundle/WebsiteBundle/Resolver/ParameterResolver.php中+
9.在ParameterResolver->resolve(数组(),对象(AdminRequestAnalyzer),对象(PageBridge),true)
在第84行的vendor/sulu/sulu/src/sulu/Bundle/WebsiteBundle/Controller/WebsiteController.php中+
10.在WebsiteController->getAttributes(数组(),对象(PageBridge),true)
在第46行的vendor/sulu/sulu/src/sulu/Bundle/WebsiteBundle/Controller/WebsiteController.php中+
11.在WebsiteController->renderStructure(对象(PageBridge),数组(),true,false)
在第41行的vendor/sulu/sulu/src/sulu/Bundle/WebsiteBundle/Controller/DefaultController.php中+
12.在DefaultController->indexAction(对象(PageBridge),true,false)
在第92行的vendor/sulu/sulu/src/sulu/Bundle/ContentBundle/Preview/PreviewRenderer.php中+
13.在PreviewRender->渲染时(对象(PageBridge),false)
在第223行的vendor/sulu/sulu/src/sulu/Bundle/ContentBundle/Preview/Preview.php中+
14.在预览->渲染结构(对象(PageBridge),false,null)
在第212行的vendor/sulu/sulu/src/sulu/Bundle/ContentBundle/Preview/Preview.php中+
15.在预览->渲染时('1','8a7d4c4a-60b4-4ced-9b3b-007e238810ff','sulu_io','en')
在第57行的vendor/sulu/sulu/src/sulu/Bundle/ContentBundle/Controller/PreviewController.php中+
16.在预览控制器->渲染(对象(请求),'8a7d4c4a-60b4-4ced-9b3b-007e238810ff')
17.在调用_user_func_数组(数组(对象(预览控制器),'renderAction')、数组(对象(请求),'8a7d4c4a-60b4-4ced-9b3b-007e238810ff')时
第3054行的app/bootstrap.php.cache中+
18.在HttpKernel->handleRaw(对象(请求),'1')
在第3016行的app/bootstrap.php.cache中+
19.在HttpKernel->handle(对象(请求),'1',true)
在第3165行的app/bootstrap.php.cache中+
20.在ContainerWarehttpkernel->handle(对象(请求),'1',true)
第2406行的app/bootstrap.php.cache中+
21.在内核->句柄(对象(请求))
在web/admin.php的第44行+

我恐怕要告诉你,这种行为是一个bug……我可以找到它并创建一个,你可以在那里跟踪进一步的进展


但是,此错误只影响预览,而不影响系统的其余部分。

您不能命名引发的异常吗?有一些组件处理元数据,根据错误文本很难判断是哪个组件出现问题。添加了异常名称和堆栈跟踪。希望这对您有所帮助。