Skip to content

Instantly share code, notes, and snippets.

@brobie
Created February 10, 2016 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brobie/980e56fff1bdb006eeba to your computer and use it in GitHub Desktop.
Save brobie/980e56fff1bdb006eeba to your computer and use it in GitHub Desktop.
public static function populateMappings(AutoloaderInterface $autoloader, DirectoryList $dirList)
{
$modulesDir = $dirList->getPath(DirectoryList::MODULES);
$generationDir = $dirList->getPath(DirectoryList::GENERATION);
$frameworkDir = $dirList->getPath(DirectoryList::LIB_INTERNAL);
$autoloader->addPsr4('Magento\\', [$modulesDir . '/Magento/', $generationDir . '/Magento/'], true);
$autoloader->addPsr0('Apache_', $frameworkDir, true);
$autoloader->addPsr0('Cm_', $frameworkDir, true);
$autoloader->addPsr0('Credis_', $frameworkDir, true);
$autoloader->addPsr0('Less_', $frameworkDir, true);
$autoloader->addPsr0('Symfony\\', $frameworkDir, true);
/** Required for Zend functionality */
FileResolver::addIncludePath($frameworkDir);
/** Required for code generation to occur */
FileResolver::addIncludePath($generationDir);
/** Required to autoload custom classes */
$autoloader->addPsr0('', [$modulesDir, $generationDir]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment