Varien_Convert_Action_Abstract Class Reference

Inheritance diagram for Varien_Convert_Action_Abstract:

Varien_Convert_Action_Interface Varien_Convert_Action

List of all members.

Public Member Functions

 getParam ($key, $default=null)
 setParam ($key, $value=null)
 getParams ()
 setParams ($params)
 getProfile ()
 setProfile (Varien_Convert_Profile_Abstract $profile)
 setContainer (Varien_Convert_Container_Interface $container)
 getContainer ($name=null)
 run ()

Protected Attributes

 $_params
 $_profile
 $_container


Detailed Description

Definition at line 37 of file Abstract.php.


Member Function Documentation

getContainer ( name = null  ) 

Get action's container

Parameters:
string $name
Returns:
Varien_Convert_Container_Abstract

Definition at line 157 of file Abstract.php.

00158     {
00159         if (!is_null($name)) {
00160             return $this->getProfile()->getContainer($name);
00161         }
00162 
00163         if (!$this->_container) {
00164             $class = $this->getParam('class');
00165             $this->setContainer(new $class());
00166         }
00167         return $this->_container;
00168     }

getParam ( key,
default = null 
)

Get action parameter

Parameters:
string $key
mixed $default
Returns:
mixed

Definition at line 69 of file Abstract.php.

00070     {
00071         if (!isset($this->_params[$key])) {
00072             return $default;
00073         }
00074         return $this->_params[$key];
00075     }

getParams (  ) 

Get all action parameters

Returns:
array

Definition at line 99 of file Abstract.php.

00100     {
00101         return $this->_params;
00102     }

getProfile (  ) 

Get profile instance the action belongs to

Returns:
Varien_Convert_Profile_Abstract

Definition at line 121 of file Abstract.php.

00122     {
00123         return $this->_profile;
00124     }

run (  ) 

Run current action

Returns:
Varien_Convert_Action_Abstract

Implements Varien_Convert_Action_Interface.

Definition at line 175 of file Abstract.php.

00176     {
00177         if ($method = $this->getParam('method')) {
00178             if (!is_callable(array($this->getContainer(), $method))) {
00179                 $this->addException('Unable to run action method: '.$method, Varien_Convert_Exception::FATAL);
00180             }
00181 
00182             $this->getContainer()->addException('Starting '.get_class($this->getContainer()).' :: '.$method);
00183 
00184             if ($this->getParam('from')) {
00185                 $this->getContainer()->setData($this->getContainer($this->getParam('from'))->getData());
00186             }
00187 
00188             $this->getContainer()->$method();
00189 
00190             if ($this->getParam('to')) {
00191                 $this->getContainer($this->getParam('to'))->setData($this->getContainer()->getData());
00192             }
00193         } else {
00194             $this->addException('No method specified', Varien_Convert_Exception::FATAL);
00195         }
00196         return $this;
00197     }

setContainer ( Varien_Convert_Container_Interface container  ) 

Set action's container

Parameters:
Varien_Convert_Container_Abstract $container
Returns:
Varien_Convert_Action_Abstract

Definition at line 144 of file Abstract.php.

00145     {
00146         $this->_container = $container;
00147         $this->_container->setProfile($this->getProfile());
00148         return $this;
00149     }

setParam ( key,
value = null 
)

Set action parameter

Parameters:
string $key
mixed $value
Returns:
Varien_Convert_Action_Abstract

Definition at line 84 of file Abstract.php.

00085     {
00086         if (is_array($key) && is_null($value)) {
00087             $this->_params = $key;
00088         } else {
00089             $this->_params[$key] = $value;
00090         }
00091         return $this;
00092     }

setParams ( params  ) 

Set all action parameters

Parameters:
array $params
Returns:
Varien_Convert_Action_Abstract

Definition at line 110 of file Abstract.php.

00111     {
00112         $this->_params = $params;
00113         return $this;
00114     }

setProfile ( Varien_Convert_Profile_Abstract profile  ) 

Set profile instance the action belongs to

Parameters:
Varien_Convert_Profile_Abstract $profile
Returns:
Varien_Convert_Action_Abstract

Definition at line 132 of file Abstract.php.

00133     {
00134         $this->_profile = $profile;
00135         return $this;
00136     }


Member Data Documentation

$_container [protected]

Definition at line 60 of file Abstract.php.

$_params [protected]

Definition at line 46 of file Abstract.php.

$_profile [protected]

Definition at line 53 of file Abstract.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:57 2009 for Magento by  doxygen 1.5.8