In this recipe, we will extend our module with a flat database table. We will create an upgradation script with the instruction to create a table. When the table is created, we will finish the setup by adding the needed Magento models, resource models, and collections. After finishing the whole setup, we have created a custom Magento entity with all the features of the Magento ORM.
For this recipe, we have to work with the code and the database. Open your IDE in the module
folder and get access to your database client.
The following steps are the instructions to create a database table with the appropriate Magento models that can interact with this table:
Configure the table name in the
app/code/local/Packt/Helloworld/etc/config.xml
file.Add the following code under the
helloworld_resource
tag so that the tag looks as follows:<helloworld_resource> <class>Packt_Helloworld_Model_Resource</class> <entities...