Ejemplo n.º 1
0
 /**
  * get attribute the type instance
  *
  * @access public
  * @return Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
  * @throws Ultimate_ModuleCreator_Exception
  * @author Marius Strajeru <*****@*****.**>
  */
 public function getTypeInstance()
 {
     if (!$this->_typeInstance) {
         $type = $this->getType();
         try {
             $types = $this->getHelper()->getAttributeTypes(false);
             $instanceModel = $types->{$type}->type_model;
             /** @var Ultimate_ModuleCreator_Model_Attribute_Type_Abstract $typeInstance */
             $typeInstance = Mage::getModel($instanceModel);
             $this->_typeInstance = $typeInstance;
             $this->_typeInstance->setAttribute($this);
         } catch (Exception $e) {
             throw new Ultimate_ModuleCreator_Exception("Invalid attribute type: " . $type);
         }
     }
     return $this->_typeInstance;
 }
Ejemplo n.º 2
0
 /**
  * get attribute the type instance
  * @access public
  * @return Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
  * @author Marius Strajeru <*****@*****.**>
  */
 public function getTypeInstance()
 {
     if (!$this->_typeInstance) {
         if (!$this->getType()) {
             $type = 'abstract';
         } else {
             $type = $this->getType();
         }
         try {
             $this->_typeInstance = Mage::getModel('modulecreator/attribute_type_' . $type);
             $this->_typeInstance->setAttribute($this);
         } catch (Exception $e) {
             throw new Ultimate_ModuleCreator_Exception("Invalid attribute type: " . $type);
         }
     }
     return $this->_typeInstance;
 }