Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

The AMI_Package_Manipulator class

• Introduction

Common package manipulator.

• Class synopsis

AMI_Package_Manipulator {
/* Properties */
// Array containing class methods to run
protected array $aActions = array();
// Array of transactions
protected array $aTx = array();
// Used to store previous exception
protected mixed $oException;
// Name for transactions, must be filled in children
protected string $txName;
/* Methods */
// Do actions.
public doActions ( ) returns void;
// Runs transactions.
public run ( ) returns void;
// Adds action.
protected addAction ( string $method, [ $aArgs = null ] ) returns void;
// Commits transactions.
protected commit ( ) returns void;
// Converts mode to string representation for logging.
protected getModeAsString ( int $mode ) returns string;
// Initializes transactions.
protected initTx ( ) returns void;
// Rollbacks transactions.
protected rollback ( [ int $index = 0 ] ) returns void;
// Validates initial data.
protected validate ( ) returns void;
}
Tags:
abstract
since 6.0.2

• Class Properies

public AMI_Package_Common $oPkgCommon
protected array $aActions

Array containing class methods to run

protected array $aTx

Array of transactions

protected mixed $oException

Used to store previous exception

var AMI_Tx_Exception

protected string $txName

Name for transactions, must be filled in children

• Class Methods

// Do actions.
public doActions ( ) returns void;
// Runs transactions.
public run ( ) returns void;
// Adds action.
protected addAction ( string $method, [ $aArgs = null ] ) returns void;
  • string $method
    This class method name
  • array $aArgs
    Method arguments
Adds action that will be called on AMI_Package_Manipulator::run().
  Example:
  •  class SomePackageManipulator extends AMI_Package_Manipulator{
  •      public function __construct(){
  •          $this->addAction('doSomethig');
  •      }
  •  
  •      protected function doSomethig(){
  •      }
  •  }
  •  
  •  $oPkgManipulator new SomePackageManipulator;
  •  try{
  •      $oPkgManipulator->run();
  •  }catch(AMI_Tx_Exception $oException){
  •      // do something else
  •  }
Tags:
see AMI_Tx::run()
// Commits transactions.
protected commit ( ) returns void;
// Converts mode to string representation for logging.
protected getModeAsString ( int $mode ) returns string;
  • int $mode
    Mode
// Initializes transactions.
protected initTx ( ) returns void;
// Rollbacks transactions.
protected rollback ( [ int $index = 0 ] ) returns void;
  • int $index
// Validates initial data.
protected validate ( ) returns void;