O'Reilly logo

Magento 2 Developer's Guide by Branko Ajzele

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating an install data script (InstallData.php)

An install data script is what gets run immediately after upgrade schema. We define install data schema within the app/code/Foggyline/Office/Setup/InstallData.php file with (partial) content as follows:

namespace Foggyline\Office\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { private $employeeSetupFactory; public function __construct( \Foggyline\Office\Setup\EmployeeSetupFactory $employeeSetupFactory ) { $this->employeeSetupFactory = $employeeSetupFactory; } public function install(ModuleDataSetupInterface $setup, ModuleContextInterface ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required