From dc4bfc6b309cd5976466bd210f7b447196b355c4 Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Tue, 25 Sep 2012 12:08:50 +0000 Subject: [PATCH] Compiler: added 'initial_state_path' SVN:trunk[2209] --- setup/compiler.class.inc.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 45190ce067..1727dc38ca 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -739,12 +739,23 @@ EOF; { $sState = $oState->getAttribute('id'); + $oInitialStatePath = $oState->GetOptionalElement('initial_state_path'); + if ($oInitialStatePath) + { + $aInitialStatePath = array(); + foreach ($oInitialStatePath->getElementsByTagName('state_ref') as $oIntermediateState) + { + $aInitialStatePath[] = "'".$oIntermediateState->GetText()."'"; + } + $sInitialStatePath = 'Array('.implode(', ', $aInitialStatePath).')'; + } + $sLifecycle .= " MetaModel::Init_DefineState(\n"; $sLifecycle .= " \"".$sState."\",\n"; $sLifecycle .= " array(\n"; $sLifecycle .= " \"attribute_inherit\" => '',\n"; $sLifecycle .= " \"attribute_list\" => array(\n"; - + $oFlags = $oState->GetUniqueElement('flags'); foreach ($oFlags->getElementsByTagName('attribute') as $oAttributeNode) { @@ -755,8 +766,12 @@ EOF; $sLifecycle .= " '$sAttCode' => $sFlags,\n"; } } - + $sLifecycle .= " ),\n"; + if (isset($sInitialStatePath)) + { + $sLifecycle .= " \"initial_state_path\" => $sInitialStatePath,\n"; + } $sLifecycle .= " )\n"; $sLifecycle .= " );\n";