mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-01 23:24:12 +01:00
- DBObject::DBInsert(Tracked)NoReload() must be used when it is not required to use the object - MetaModel::GetObject() has a cache, the operation is 5 times faster - Changes tracking do not store the initial value, but only value changes Reworked the CSV import to have it rely on the bulk change API Bulk change to check the external keys (DB integrity) Replaced trigger_error (Core only!) by the use of Exceptions (still, some new Exception classes should be defined) Unit tests do display the call stack in a user friendly format SVN:code[52]
60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* A stimulus is the trigger that makes the lifecycle go ahead (state machine)
|
|
*
|
|
* @package iTopORM
|
|
* @author Romain Quetiez <romainquetiez@yahoo.fr>
|
|
* @author Denis Flaven <denisflave@free.fr>
|
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
|
* @link www.itop.com
|
|
* @since 1.0
|
|
* @version 1.1.1.1 $
|
|
*/
|
|
|
|
class ObjectStimulus
|
|
{
|
|
private $m_aParams = array();
|
|
|
|
public function __construct($aParams)
|
|
{
|
|
$this->m_aParams = $aParams;
|
|
$this->ConsistencyCheck();
|
|
}
|
|
|
|
public function Get($sParamName) {return $this->m_aParams[$sParamName];}
|
|
|
|
// Note: I could factorize this code with the parameter management made for the AttributeDef class
|
|
// to be overloaded
|
|
static protected function ListExpectedParams()
|
|
{
|
|
return array("label", "description");
|
|
}
|
|
|
|
private function ConsistencyCheck()
|
|
{
|
|
|
|
// Check that any mandatory param has been specified
|
|
//
|
|
$aExpectedParams = $this->ListExpectedParams();
|
|
foreach($aExpectedParams as $sParamName)
|
|
{
|
|
if (!array_key_exists($sParamName, $this->m_aParams))
|
|
{
|
|
$aBacktrace = debug_backtrace();
|
|
$sTargetClass = $aBacktrace[2]["class"];
|
|
$sCodeInfo = $aBacktrace[1]["file"]." - ".$aBacktrace[1]["line"];
|
|
throw new CoreException("missing parameter '$sParamName' in ".get_class($this)." declaration for class $sTargetClass ($sCodeInfo)");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class StimulusUserAction extends ObjectStimulus
|
|
{
|
|
}
|
|
|
|
?>
|