September 2018
Beginner to intermediate
218 pages
4h 27m
English
The InstallData script is used when we wish to add new data to existing tables. This script is run only when a module is enabled. Once enabled, the module gets a corresponding entry under the setup_module.data_version table column. This entry prevents the InstallData script to run on any subsequent setup:upgrade command execution, where the module's setup_version remains the same.
Let's create the <MAGELICIOUS_DIR>/Core/Setup/InstallData.php file with the following content:
use \Magento\Framework\Setup\InstallDataInterface;use Magento\Framework\Setup\ModuleContextInterface;use Magento\Framework\Setup\ModuleDataSetupInterface;class InstallData implements InstallDataInterface { public function install(ModuleDataSetupInterface ...Read now
Unlock full access