nymo / silex-twig-breadcrumb-extension

Twig breadcrumb extension with service provider for Silex
MIT License
7 stars 6 forks source link

Get FatalErrorException #4

Closed bambamboole closed 8 years ago

bambamboole commented 9 years ago

Hey,

I get the error: FatalErrorException in BreadCrumbCollection.php line 71: Error: Call to a member function generate() on null

My app.php looks like

<?php
use Silex\Application;
use Silex\Provider;

//
// Application setup
//
$app = new Application();
$app->register(new Provider\DoctrineServiceProvider());
$app->register(new Provider\SecurityServiceProvider());
$app->register(new Provider\RememberMeServiceProvider());
$app->register(new Provider\SessionServiceProvider());
$app->register(new Provider\ServiceControllerServiceProvider());
$app->register(new Provider\UrlGeneratorServiceProvider());
$app->register(new Provider\TwigServiceProvider());
$app->register(new \nymo\Silex\Provider\BreadCrumbServiceProvider());

$app['twig.path'] = array(__DIR__ . '/../templates');
//$app['twig.options'] = array('cache' => __DIR__ . '/../var/cache/twig');
$app['twig'] = $app->share(
  $app->extend(
    'twig',
    function ($twig, $app) {
      $twig->addExtension(new \nymo\Twig\Extension\BreadCrumbExtension($app));
      return $twig;
    }
  )
);

$app->register(new Provider\SwiftmailerServiceProvider());
// Register the SimpleUser service provider.
$simpleUserProvider = new SimpleUser\UserServiceProvider();
$app->register($simpleUserProvider);
//
// Controllers
//
$app->mount('/user', $simpleUserProvider);
$app->get('/', 'Piano\Controller\PagesController::indexAction')->bind('homepage');
$app->get('/ueber-uns', 'Piano\Controller\PagesController::aboutAction')->bind('about');

require __DIR__ . '/../config/local.php';
return $app;
nymo commented 9 years ago

Could you provide me the version of Silex you are using? Then I will have a look into that

bambamboole commented 9 years ago

My version:

      {
        "name": "silex/silex",
        "version": "v1.2.4",
        "source": {
            "type": "git",
            "url": "https://github.com/silexphp/Silex.git",
            "reference": "417deb440eecf776df868d8760d0b7d8e2c4e6d1"
        }
nymo commented 9 years ago

@bambamboole sorry I that I didn't respond for so long. I did a clean skeleton install with Silex 1.2.4 and configured the Breadcrumb Extension as mentioned in the readme. The app is still working and the breadcrumbs are displayed. Which Version of the extension are you using? I did the test with V1.1.

Looking at the error message I think the problem could be that you are trying to display the breadcrumbs on some page with {{renderBreadCrumbs()}} but did not initialize them in the controller?

Anyway since it has been a long time since your post of this issue do you still have it or is it already solved?

nymo commented 8 years ago

Will close this please reopen if you still have problems.