Skip to content

Instantly share code, notes, and snippets.

@brobie
brobie / gist:5cfb055ec190f40bb8c059c31ab430f6
Created May 25, 2017 01:58
Joining Data For Order Grid
<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">
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);
Populator::populateMappings($autoloadWrapper, $dirList);
$this->directories[self::SYS_TMP] = [self::PATH => realpath(sys_get_temp_dir())];
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'],
return new DirectoryList($rootDir, $customDirs);
public static function populateAutoloader($rootDir, $initParams)
{
$dirList = self::createFilesystemDirectoryList($rootDir, $initParams);
$autoloadWrapper = AutoloaderRegistry::getAutoloader();
Populator::populateMappings($autoloadWrapper, $dirList);
}
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);
AutoloaderRegistry::registerAutoloader(new ClassLoaderWrapper($composerAutoloader));
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}