Posts tagged ‘Models’
Models
Models
Models are the muscle ofMagento. They help move data from the database into the program itself. The output, or rendering, of the data is done by the Blocks, but the models are mainly responsible for manipulating the data. Models, in any programming environment, help to identify and shape data domains. What this means is that models draw boundaries between definitions of data groups and relate data groups to other data groups.
To help illustrate the idea of data modeling imagine creating a shopping cart system and that you want to have a Product class. This product should have an image associated with it. But, the question is, how does that image get modeled? Do you simply give the product one $image_url variable? Perhaps it is best to link the Product class to an Image_Gallery class and create linking methods between the two, e.g. getDefaultImage. The resulting model classes are the end result of your decision on how the data interrelates.
Recent Comments