Limitation of Mage::getModel method

Magento getModel can not initialise an instance whose class requires more than 1 argument.

I assume Magento native classes can explode options from the first argument to satisfy getModel. However, if I want to use 3rd party class like Zend_Form_Element inside Magento, there is no ways to use getModel to achieve the same result as

$element = new Zend_Form_Text('name', $options);


$element = Mage::getModel('moduleName/modelName', 'name');

takes 1 argument which is ‘name’ only. No way to pass $options on.

Leave a comment

Your email address will not be published. Required fields are marked *