Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined method registerNamespaces() symfony2

I'm following this FOSTwitterBundle documentation: https://github.com/FriendsOfSymfony/FOSTwitterBundle

I did it all step by step, but when I access my site, i get this error:

 Fatal error: Call to undefined method Composer\Autoload\ClassLoader::registerNamespaces() in C:\xampp\htdocs\Symfony\app\autoload.php on line 16

My autoload.php is like this:

<?php

use Doctrine\Common\Annotations\AnnotationRegistry;

$loader = require __DIR__.'/../vendor/autoload.php';

// intl
if (!function_exists('intl_get_error_code')) {
    require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';

    $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
}

AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

$loader->registerNamespaces(array(
        // ...
        'FOS'    => __DIR__.'/../vendor/bundles',
        // ...
  ));

return $loader;

What should I do?

like image 945
Reinherd Avatar asked Dec 07 '22 09:12

Reinherd


1 Answers

for symfony 2.* replace this

$loader->add('FOS' => __DIR__.'/../vendor/bundles');

with

$loader->add('FOS', __DIR__.'/../vendor/bundles');
like image 93
Md. Modasser Hossain Avatar answered Dec 09 '22 01:12

Md. Modasser Hossain