Note that there are some explanatory texts on larger screens.

plurals
  1. POBundle Does Not Exist: Symfony2
    primarykey
    data
    text
    <p>I'm pretty new to Symfony2. I can't figure out what's going on. This code (set up to test if the bundle can be detected): <pre><code>use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Ivory\GoogleMap\Overlays\Animation; use Ivory\GoogleMap\Overlays\Marker; class DefaultController extends Controller { public function mapAction() { $map = $this-&gt;get ( 'ivory_google_map.map' ); return $this-&gt;render ( 'KrewMediaLocalFarmBundle:Default:map.html.twig', array('map' =&gt; $map) ); } } </code></pre> <p>works, rendering a simple map, while this code (the real code that involves embedding a controller to render a map with data) </p> <pre><code>&lt;?php // localfarm/src/KrewMedia/Bundle/LocalFarmBundle/Controller/DefaultController.php namespace KrewMedia\Bundle\LocalFarmBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Ivory\GoogleMap\Overlays\Animation; use Ivory\GoogleMap\Overlays\Marker; class DefaultController extends Controller { public function mapAction() { //$map = $this-&gt;get ( 'ivory_google_map.map' ); return $this-&gt;render ( 'KrewMediaLocalFarmBundle:Default:maptest.html.twig'); } } </code></pre> <p>gives me this error: "An exception has been thrown during the rendering of a template ("Bundle "LocalFarmBundle" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your AppKernel.php file?") in KrewMediaLocalFarmBundle:Default:maptest.html.twig at line 3."</p> <p>Both maptest.html.twig and map.html.twig are in the same folder in the LocalFarmBundle. I wonder why the bundle is found in the first piece of code but not in the second. The relevant routing is this</p> <pre><code>krew_media_local_farm_homepage: pattern: /index defaults: { _controller: KrewMediaLocalFarmBundle:Default:index } krew_media_local_farm_map: pattern: /map defaults: { _controller: KrewMediaLocalFarmBundle:Default:map } krew_media_basic_map: pattern: /map/basic defaults: { _controller: KrewMediaLocalFarmBundle:Map:basic } </code></pre> <p>map.html.twig:</p> <pre><code>{{ google_map_container(map) }} {{ google_map_js(map) }} </code></pre> <p>maptest.html.twig:</p> <pre><code>Map Test {% render(controller( 'LocalFarmBundle:Map:basic')) %} </code></pre> <p>The controller for 'LocalFarmBundle:Map:basic':</p> <pre><code>public function basicAction() { // set up map $map = $this-&gt;get ( 'ivory_google_map.map' ); // Get User geo info $user = $this-&gt;getUser (); if (isset ( $user )) { // check to see if logged in: map is useless without it $map-&gt;setAutoZoom ( true ); $map-&gt;setStylesheetOption('width', '500px'); $map-&gt;setStylesheetOption('height', '500px'); $radius = 1; // get repository for user class $coordList = $this-&gt;container-&gt;get ( 'sylius.repository.user' )-&gt;findUsersNearUser ( $user, $radius ); // set user marker $this-&gt;placeMarker ( $user, "/assets/img/home.png", $map ); if (! empty ( $coordList )) { foreach ( $coordList as $geo ) { $this-&gt;placeMarker ( $geo, "/assets/img/neighbor.png", $map ); } } // get furthest distance $dist = $this-&gt;getFurthestDistance ( $user, $coordList ); // set invisible boundary markers $this-&gt;addBoundaries ( $user, $dist, $map ); // render the map } else { echo "You are not logged in. Please log in and try again."; } return $this-&gt;render ( 'KrewMediaLocalFarmBundle:Default:map.html.twig', array ( 'map' =&gt; $map ) ); </code></pre> <p>Any help would be appreciated in figuring out this problem. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload