0
votes

I am new to Symfony, and I am in the process of doing some basic configuration. When running my application on my localhost I keep getting the error below. Does anyone know how to solve this error:

Some sections on my autoload.php are commented out.

Thanks in advance.

RuntimeException: The autoloader expected class "IWA\AppBundle\AppBundle" to be defined in file "C:\xampp\htdocs\Rumbie\intranet/src\IWA\AppBundle\AppBundle.php". The file was found but the class was not in it, the class name or namespace probably has a typo.

My AppBundle looks like this:

<?php

namespace IWAAppBundle\AppBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AppBundle extends Bundle
{


}

And my autoload file looks like this:

<?php

use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
use Symfony\Component\ClassLoader\UniversalClassLoader;

/**
 * @var ClassLoader $loader
 */

#$loader = new UniversalClassLoader();

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

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

#$loader ->add('FOS', __DIR__.'/../vendor/friendsofsymfony/user-bundle/FOS');



$loader->registerNamespaces(array(

        'FOS' =>$vendor_dir .'/bundles',
        #'Symfony' => array('FOS' => _DIR_.'/../vendor/bundles',

)

);

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

return $loader;
1
I think you need to change your namespace to Iwa\AppBundle in IwaAppBundle.php. Just generate your bundles with app/console.Canser Yanbakan

1 Answers

0
votes
IWA\AppBundle\AppBundle
namespace IWAAppBundle\AppBundle;

class AppBundle ...

Do you spot the difference? You're using a class as IWA\AppBundle\AppBundle, but you defined it as IWAAppBundle\AppBundle\AppBundle.