473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Symfony, CMS tutorial, do not understand where is my mistake

103 100+
I am following online tutorial for Symfony CMS: http://symfony.com/doc/master/cmf/tutorial/introduction.html

I am getting the error:
An exception has been thrown during the rendering of a template ("The menu "main" is not defined.") in src\Acme\BasicCmsBundle\Resources\views\Default\pa ge.html.twig at line 4.
500 Internal Server Error - Twig_Error_Runtime
1 linked Exception:
InvalidArgumentException »


I am on the page about menu
http://symfony.com/doc/master/cmf/tutorial/the-frontend.html


Where is the mistake?



Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. // src/Acme/BasicCmsBundle/DataFixtures/PHPCR/LoadPageData.php
  4. namespace Acme\BasicCmsBundle\DataFixtures\PHPCR;
  5.  
  6. use Acme\BasicCmsBundle\Document\Page;
  7. use Doctrine\Common\DataFixtures\FixtureInterface;
  8. use Doctrine\Common\Persistence\ObjectManager;
  9. use Doctrine\ODM\PHPCR\DocumentManager;
  10.  
  11. class LoadPageData implements FixtureInterface
  12. {
  13.     public function load(ObjectManager $dm)
  14.     {
  15.         if (!$dm instanceof DocumentManager) {
  16.             $class = get_class($dm);
  17.             throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given.");
  18.         }
  19.  
  20.         $parent = $dm->find(null, '/cms/pages');
  21.  
  22.         $rootPage = new Page();
  23.         $rootPage->setTitle('main');
  24.         $rootPage->setParentDocument($parent);
  25.         $dm->persist($rootPage);        
  26.  
  27.         $page = new Page();
  28.         $page->setTitle('Home');
  29.         //$page->setParentDocument($parent);
  30.         $page->setParentDocument($rootPage);
  31.         $page->setContent(<<<HERE
  32. Welcome to the homepage of this really basic CMS.
  33. HERE
  34.         );
  35.  
  36.         $dm->persist($page);
  37.  
  38.         $page = new Page();
  39.         $page->setTitle('About');
  40.         $page->setParentDocument($rootPage);
  41.         $page->setContent(<<<HERE
  42. This page explains what its all about.
  43. HERE
  44.         );
  45.         $dm->persist($page);
  46.  
  47.         $dm->flush();
  48.     }
  49. }
  50.  
  51.  

Expand|Select|Wrap|Line Numbers
  1. {# src/Acme/BasicCmsBundle/Resources/views/Default/page.html.twig #}
  2. <h1>{{ page.title }}</h1>
  3.  
  4. {{ knp_menu_render('main') }}
  5.  
  6. <p>{{ page.content|raw }}</p>
  7. <h2>Our Blog Posts</h2>
  8. <ul>
  9.     {% for post in posts %}
  10.         <li><a href="{{ path(post) }}">{{ post.title }}</a></li>
  11.     {% endfor %}
  12. </ul>
Oct 16 '15 #1
0 953

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: binnyva | last post by:
Hello Everyone, I have just compleated a JavaScript tutorial and publishing the draft(or the beta version, as I like to call it) for review. This is not open to public yet. The Tutorial is...
0
by: Narko | last post by:
Symfony Lessons I propose self-written free Symfony framework lessons for everyone: http://narkozateam.com/symfony/ If you want to know more about PHP, AJAX, MVC - take a look there and give me...
0
by: php.developer2007 | last post by:
I m getting this error when i type this at php symfony -V or symfony - V "Could not open input file: symfony" Help me if any one can
2
by: gintare | last post by:
1) Symfony, where is defined the method getRepository? I have a line in the code: $posts = $this->getDoctrine()->getRepository('ModelBundle:Post)->findAll(); i do not understand in which file...
1
by: gintare | last post by:
Could you please help me with "Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException" . You have requested a non-existent parameter "Could not determine the Doctrine manager....
0
by: gintare | last post by:
I am trying to make symfony project cms1 and install CMS bundles to it: cd to folder where the symfony is installed create project: c:\> php symfony.phar new cmf1 run the project: $ cd .\cmf1...
1
by: gintare | last post by:
I am trying to install Symfony CMS according to http://symfony.com/doc/current/cmf/book/installation.html#set-up-the-database I am not able to set-up the database. I am getting the error:...
1
by: gintare | last post by:
I am following online tutorial for Symfony CMS: http://symfony.com/doc/master/cmf/tutorial/introduction.html On the final page the routing is created:...
0
by: gintare | last post by:
There are three questions. I am following the Symfony tutorial: http://symfony.com/doc/master/cmf/tutorial/content-to-controllers.html (It starts from :...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.