Skip to content

Instantly share code, notes, and snippets.

@6ui11em
Created May 14, 2019 08:48
Show Gist options
  • Save 6ui11em/2fcbf696e89a5be76e9eba530ee07e2c to your computer and use it in GitHub Desktop.
Save 6ui11em/2fcbf696e89a5be76e9eba530ee07e2c to your computer and use it in GitHub Desktop.
Magento 2: installData core_config_data #magento2, #installdata, #config
<?php
/**
* InstallData
*
* @copyright Copyright © 2019 The Etailers. All rights reserved.
* @author [email protected]
*/
namespace FERR\AlternateHreflang\Setup;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
$data = [
'scope' => 'default',
'scope_id' => 0,
'path' => 'path/to/config_param',
'value' => 'value',
];
$setup->getConnection()
->insertOnDuplicate($setup->getTable('core_config_data'), $data, ['value']);
$setup->endSetup();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment