Models and saving data

Before jumping straight to creating our models, we need to define clearly what type of models we are going to build and how many. So let's review our example scenario. For our gift registry, it appears that we will need two different models, which are as follows:

  • Registry model: This is used to store the gift registry information such as gift registry type, address, and recipient information
  • Registry item: This is used to store the information of each of the gift registry items (for example, quantity requested, quantity bought, and product_id)

Although this approach is correct, it does not meet all the requirements of our example scenario. By having all the registry information stored in a single table, we cannot add more registry ...

Get Magento PHP Developer's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.