Я пытаюсь расширить класс 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 +
Я боюсь сказать вам, что это поведение является ошибкой … Я мог бы отследить это немного и создал вопрос на GitHub, Вы можете отслеживать дальнейший прогресс там.
Однако эта ошибка влияет только на предварительный просмотр, но не на остальную систему.
Других решений пока нет …