Symfony, CMS tutorial. How to know config.yml syntax? How routes are mapped?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gintare
    New Member
    • Mar 2007
    • 103

    Symfony, CMS tutorial. How to know config.yml syntax? How routes are mapped?

    There are three questions.

    I am following the Symfony tutorial:
    Nowadays only providing the CMF routing. The repositories of the other components are archived and marked as abandoned, but will stay available. - Symfony CMF


    (It starts from :
    Nowadays only providing the CMF routing. The repositories of the other components are archived and marked as abandoned, but will stay available. - Symfony CMF

    Tutorial :
    Nowadays only providing the CMF routing. The repositories of the other components are archived and marked as abandoned, but will stay available. - Symfony CMF

    )

    1) Where i could get listed keywords used in "app/config/config.yml" and where i could get explained this file creation rules. It is easy to copy the tutorial, but i do not understand how to make this without tutorial.
    For instance, they add the keyword: "controllers_by _class:" . Where is the documentation for this keyword used on config.yml?

    2) How webpage "src\Acme\Basic CmsBundle\Resou rces\views\Defa ult\page.html.t wig" is loaded? According the tutorial i make corrections in config.yml and default controller. None of them contain the name of the template. Thus it is not clear for me how program loads "page.html.twig " than i go to "http://127.0.0.1:8000/page/home".


    3) I need the answers to the above questions in order i could by myself create the remaining configurations and controller actions. Tutorial gives one example and suggests to create the webpages, controller actions and configurations for the rest of the links. I have to be able to view the link=reference "my first post" in "http://127.0.0.1:8000/page/home". I am getting the error:
    Code:
    Unable to find the controller for path "/post/2015-10-16/my-first-post". The route is wrongly configured.
    404 Not Found - NotFoundHttpException
    As far as i understand i have to create "src\Acme\Basic CmsBundle\Resou rces\views\Defa ult\post.html.t wig".

    <h1>{{ post.title }}</h1>
    <p>{{ post.content|ra w }}</p>[/CODE]


    Than to retrieve "My First Post" contents from database (which is loaded to the database from the fixtures or by creating the post in the website) and render with this content the "post.html.twig " template?
    How to make this? I believe it must be an action in the controller?
    Code:
    src\Acme\BasicCmsBundle\Controller\DefaultController.php
    ..
        public function postAction($contentDocument)
        {
            $dm = $this->get('doctrine_phpcr')->getManager();
    
    // how to know which post i have to find? If i go to url "http://127.0.0.1:8000/page/my-first-post", I need to retrieve the first post. Which function analise the url?
           $post = $dm->getRepository('AcmeBasicCmsBundle:Post')->find ??
    
         // what to  return ?
        }


    Do i need to make additional adjustments in config.yml?
    Code:
     simpleCMS\app\config\config.yml
        sonata_doctrine_phpcr_admin:
        document_tree_defaults: [locale]
        document_tree:
            Doctrine\ODM\PHPCR\Document\Generic:
                valid_children:
                    - all
            Acme\BasicCmsBundle\Document\Page:
                valid_children:
                    - Acme\BasicCmsBundle\Document\Post
            Acme\BasicCmsBundle\Document\Post:
                valid_children: []
    Last edited by Rabbit; Oct 16 '15, 04:40 PM. Reason: Personal email removed per forum policy
Working...