symfony/symfony-docs — pull request #782 by johnkary (2011-10-19 00:52:44+00:00)
Title: [cookbook][autoloader] Add explicit register()

Someone asked me for help figuring out why their UniversalAutoloader wasn't picking up their class in a new non-framework project they were just starting. They had checked and double-checked their folder hierarchy, class namespaces, etc. They said that after an hour they had given up and asked me out of frustration. Turns out, this was their `bootstrap.php` code:

registerNamespace('Aquia', __DIR__ . '/src');

They were missing `$loader->register()`. Even though it's in the top two examples on the docs page they were following at http://symfony.com/doc/current/cookbook/tools/autoloader.html , they didn't realize it was required when registering a namespace because it wasn't included in the code sample.

This change adds `$loader->register()` to all subsequent examples on the docs page.