Tag Archives: models

HOWTO: Design good Domain model

Designing domain models is probably the first thing that every software developer learns in school.

The concept for good domain model is quite simple: diagram representing the business objects (entities) in a system and the relations among them.

The purpose of the domain model is to create a common language, terminology and understanding for the system and the business around it.

Even though it might be a simple and well-known definition it somehow seems to be also quite tricky and hard to follow through.

Continue reading HOWTO: Design good Domain model

Magento Architecture – Blocks, Models, Helpers

Magento is structured from many small modules working and existing as atomicly as possible. The typical Magento architecture for each module is divided on Blocks, Models, Helpers.

Tips: If you want to see more about most Magento interesting configuration one good class for that is core/code/Mage/Core/Model/Config.php

Now the interesting part have you thought why there are Mage::getModel(”) and Mage::getResourceModel(”) but Mage::helper?

Well, I still have not answer to that question. XD

But I have thought a lot of why you are able to get Mage::helper(‘unique_name’) but you able only to that -> Mage::getModel(‘unique_name/filename’) for the models.

Well, the answer is easy and it is in core/code/Mage/Core/Model/Config.php

public function getModelClassName($modelClass) {
    $modelClass = trim($modelClass);
    if (strpos($modelClass, '/') === false) {
        return $modelClass;
    return $this->getGroupedClassName('model', $modelClass);

public function getHelperClassName($helperName) {
    if (strpos($helperName, '/') === false) {
        $helperName .= '/data';
    return $this->getGroupedClassName('helper', $helperName);

In the helper one Magento configuration adds automatically /data if there is no slash in the $helperName so if you write something from this kind Mage::helper(‘unique_name’) it is presenting Data.php file in your Helper folder that this unique_name is defining it will be loaded automatically.