Skip to content

Instantly share code, notes, and snippets.

View gist:5cfb055ec190f40bb8c059c31ab430f6
<virtualType name="Magento\Sales\Model\ResourceModel\Order\Grid" type="Magento\Sales\Model\ResourceModel\Grid">
<arguments>
<argument name="joins" xsi:type="array">
<item name="table_that_you_want_to_join" xsi:type="array">
<item name="table" xsi:type="string">table_that_you_want_to_join</item>
<item name="origin_column" xsi:type="string">entity_id</item>
<item name="target_column" xsi:type="string">parent_id</item>
</item>
</argument>
<argument name="columns" xsi:type="array">
View gist:980e56fff1bdb006eeba
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);
View gist:2c51fe0f63d0a45f9a17
Populator::populateMappings($autoloadWrapper, $dirList);
View gist:b88f0158bac37f115715
$this->directories[self::SYS_TMP] = [self::PATH => realpath(sys_get_temp_dir())];
View gist:a72f1cb6690d365c6fc9
public static function getDefaultConfig()
{
$result = [
self::ROOT => [parent::PATH => ''],
self::APP => [parent::PATH => 'app'],
self::MODULES => [parent::PATH => 'app/code'],
self::CONFIG => [parent::PATH => 'app/etc'],
self::LIB_INTERNAL => [parent::PATH => 'lib/internal'],
self::VAR_DIR => [parent::PATH => 'var'],
self::CACHE => [parent::PATH => 'var/cache'],
View gist:f55eae98e460bf1a8720
return new DirectoryList($rootDir, $customDirs);
View gist:0babb66306e960e181ac
public static function populateAutoloader($rootDir, $initParams)
{
$dirList = self::createFilesystemDirectoryList($rootDir, $initParams);
$autoloadWrapper = AutoloaderRegistry::getAutoloader();
Populator::populateMappings($autoloadWrapper, $dirList);
}
View gist:0b44b13c186e69d59f3e
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);
View gist:55260f1c080f1c7c241b
AutoloaderRegistry::registerAutoloader(new ClassLoaderWrapper($composerAutoloader));
View gist:e9173e1e8b62476e3d62
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}