1

I need to save some data while custom module installation. I save some static data using setup/InstallData.php. I need to process the existing order data and save it into my custom table. Is there any other way to save instead of setup/InstallData.php. Is this good to call controller function inside the setup/InstallData.php.

I am using Magento 2.2.6

0

1 Answer 1

1

Is this good to call controller function inside the setup/InstallData.php

No, it is not recommended controller call should be from request.

Is there any other way to save instead of setup/InstallData.php

No, not any because whenever module is installing only InstallData script are run.

But you can create command line file after installing module you can run command and it will import your order data in custom table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.