CreateBundle Symfony CMF

475 views Asked by At

I am trying to use the create bundle symfony cmf. So far everything works because I am able to edit blocks but I am not able to save my content. I get the following error:

Error occurred while saving
[{"message":"Not found: cms\/test","class":"RuntimeException","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/var\/www\/JudoSharp\/vendor\/midgard\/createphp\/src\/Midgard\/CreatePHP\/Mapper\/DoctrinePhpcrOdmMapper.php","line":86,"args":[]},{"namespace":"Midgard\\CreatePHP\\Mapper","short_class":"DoctrinePhpcrOdmMapper","class":"Midgard\\CreatePHP\\Mapper\\DoctrinePhpcrOdmMapper","type":"->","function":"getBySubject","file":"\/var\/www\/JudoSharp\/vendor\/symfony-cmf\/create-bundle\/Symfony\/Cmf\/Bundle\/CreateBundle\/Controller\/RestController.php","line":89,"args":[["string","cms\/test"]]},{"namespace":"Symfony\\Cmf\\Bundle\\CreateBundle\\Controller","short_class":"RestController","class":"Symfony\\Cmf\\Bundle\\CreateBundle\\Controller\\RestController","type":"->","function":"getModelBySubject","file":"\/var\/www\/JudoSharp\/vendor\/symfony-cmf\/create-bundle\/Symfony\/Cmf\/Bundle\/CreateBundle\/Controller\/RestController.php","line":108,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["string","cms\/test"]]},{"namespace":"Symfony\\Cmf\\Bundle\\CreateBundle\\Controller","short_class":"RestController","class":"Symfony\\Cmf\\Bundle\\CreateBundle\\Controller\\RestController","type":"->","function":"putDocumentAction","file":null,"line":null,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["string","cms\/test"]]},{"namespace":"","short_class":"","class":"","type":"","function":"call_user_func_array","file":"\/var\/www\/JudoSharp\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpKernel.php","line":117,"args":[["array",[["object","Symfony\\Cmf\\Bundle\\CreateBundle\\Controller\\RestController"],["string","putDocumentAction"]]],["array",[["object","Symfony\\Component\\HttpFoundation\\Request"],["string","cms\/test"]]]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"HttpKernel","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"->","function":"handleRaw","file":"\/var\/www\/JudoSharp\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpKernel.php","line":61,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["string","1"]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"HttpKernel","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"->","function":"handle","file":"\/var\/www\/JudoSharp\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/DependencyInjection\/ContainerAwareHttpKernel.php","line":62,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["string","1"],["boolean",true]]},{"namespace":"Symfony\\Component\\HttpKernel\\DependencyInjection","short_class":"ContainerAwareHttpKernel","class":"Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel","type":"->","function":"handle","file":"\/var\/www\/JudoSharp\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/Kernel.php","line":187,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["string","1"],["boolean",true]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"Kernel","class":"Symfony\\Component\\HttpKernel\\Kernel","type":"->","function":"handle","file":"\/var\/www\/JudoSharp\/web\/app_dev.php","line":28,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"]]}]}] 

The front-end code that I'm using is the following:

<div about="cms/test" typeof="schema:WebPage" xmlns:schema="http://schema.org/">
    <h1 property="schema:headline">Hey bra</h1>
    <div property="schema:text">
        <h2>Welcome to the Symfony CMF Demo</h2>
        <p>If you see this page, it means that the...</p>
    </div>
    <p>Brotha!</p>
    <p property="schema:sdlkfj">hey</p>
</div>

What I'm not sure of is what the "about" attribute is for. "about=cms/test" is just some arbitrary value I put in. I guess it represents some phpcr-odm node, but I'm not even sure where to set that node up or even how these documents work. I've created my phpcr-odm database for my project and phpcr-odm is working, but I'm not really sure how all this stuff is suppose to work. I'm really new to symfony cmf. Please let me know how to save content with create bundle as the documentation sucks. I've also read the phpcr-odm doctrine documentation which makes sense, but I'm not sure how to relate it to this issue.

Thanks.

1

There are 1 answers

2
dbu On

You guessed correctly that about is the ID of the phpcr-odm document. every document has its path in PHPCR which identifies it. You would need to specify the ID of a document that exists in the "about". the easiest would be to map the id and do about="{{cmfMainContent.id}}"

but What really want to do is read about the rdf mapping: http://symfony.com/doc/master/cmf/bundles/create/introduction.html#metadata once you defined that, you can use the twig helpers to render those attributes: http://symfony.com/doc/master/cmf/bundles/create/introduction.html#rendering-content

If you have further questions, please open a github issue on https://github.com/symfony-cmf/CreateBundle/