Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Create A Module With Custom
Database Table In Magento 2
Provided By Mageworld
A Leading Magento Provider
OUTLINE
Step 1
•Create a new module (Tutorial_SimpleNews)
Step 2
•Create configuration file.
Step 3
•Create the installati...
Create a new table in the database of
Magento 2 with the structure as follows:
Table name: tutorial_simplenews
Step 1: Create a new module
(Tutorial_SimpleNews)
Step 2: Create configuration file.
 Create file:
app/code/Tutorial/SimpleNews/etc/module.xml
 Purpose: declare the module
Step 3: Create the installation file.
 Create
file: app/code/Tutorial/SimpleNews/Setup/InstallSchema.php
 Purpose: decla...
Step 4: Activate the module.
 Active this module by
opening:
app/etc/config.php file
 Add this line into it
 Step 4.1:
Step 4: Activate the module.
Open the
Command in
Windows
Go to Magento
root folder
Run this
command line
to install module...
Step 4: Activate the module.
 Step 4.3: Check database: the tutorial_simplenews table is
created successfully
Following Mageworld Magento2 Tutorial Series..
Upcoming SlideShare
Loading in …5
×

Create A Module With Custom Database Table In Magento 2

After the first tutorial on how to create a simple module in Magento 2, we hope you can create a module by yourself easily. If you still have problem, don’t hesitate to discuss with us through our facebook fanpage. In this second blog post, I will introduce you how to create a module with custom database table in Magento 2.

  • Login to see the comments

Create A Module With Custom Database Table In Magento 2

  1. 1. Create A Module With Custom Database Table In Magento 2 Provided By Mageworld A Leading Magento Provider
  2. 2. OUTLINE Step 1 •Create a new module (Tutorial_SimpleNews) Step 2 •Create configuration file. Step 3 •Create the installation file. Step 4 •Activate the module.
  3. 3. Create a new table in the database of Magento 2 with the structure as follows: Table name: tutorial_simplenews
  4. 4. Step 1: Create a new module (Tutorial_SimpleNews)
  5. 5. Step 2: Create configuration file.  Create file: app/code/Tutorial/SimpleNews/etc/module.xml  Purpose: declare the module
  6. 6. Step 3: Create the installation file.  Create file: app/code/Tutorial/SimpleNews/Setup/InstallSchema.php  Purpose: declare and create the custom table => Go to our blog tutorial for full source code
  7. 7. Step 4: Activate the module.  Active this module by opening: app/etc/config.php file  Add this line into it  Step 4.1:
  8. 8. Step 4: Activate the module. Open the Command in Windows Go to Magento root folder Run this command line to install module Module: binmagento setup:upgrade  Step 4.2:
  9. 9. Step 4: Activate the module.  Step 4.3: Check database: the tutorial_simplenews table is created successfully
  10. 10. Following Mageworld Magento2 Tutorial Series..

×