/** * Retourne la table associee a la propriete $p de l'entite $e * * @access public * @static * @param string $e le nom de l'entité * @param string $p le nom de la propriété * @return string **/ public static function getPropertyTableName($e, $p) { $p = Registry::getPropertyClassname($e, $p); require_once MODELS_DIR . '/' . $p . '.php'; return call_user_func(array($p, 'getTableName')); }
/** * Construit un automate à état à partir d'une liste de macros * * @access private * @param array $macros * @return void */ private function _initializeFromMacros($macros) { $pathNodes = array(); $this->_startState = new StateMachineNode($this->entity, true); foreach ($macros as $macro) { $curState = $this->_startState; $curEntity = $this->entity; $macroTokens = explode('.', $macro); if (is_array($macroTokens) && count($macroTokens) > 1) { $curPath = ''; foreach ($macroTokens as $macroToken) { if (strpos($macroToken, '@') !== false) { list($macroToken, $curEntity) = explode('@', $macroToken); } else { $curEntity = Registry::getPropertyClassname($curEntity, $macroToken); } $curPath .= '.' . $macroToken; if (isset($pathNodes[$curPath])) { $nextState = $pathNodes[$curPath]; } else { $nextState = new StateMachineNode($curEntity); $pathNodes[$curPath] = $nextState; $curState->transitions[$macroToken] = $nextState; } $curState = $nextState; } } else { $curPath = '.' . $macro; $curEntity = Registry::getPropertyClassname($curEntity, $macro); if (!isset($pathNodes[$curPath])) { $nextState = new StateMachineNode($curEntity); $pathNodes[$curPath] = $nextState; $curState->transitions[$macro] = $nextState; } } if (is_string($curEntity) && $curEntity == 'I18nString') { $curState = $nextState; $macroToken = 'StringValue_' . I18n::getLocaleCode(); $curPath .= '.' . $macroToken; $curEntity = Registry::getPropertyClassname($curEntity, $macroToken); if (isset($pathNodes[$curPath])) { $nextState = $pathNodes[$curPath]; } else { $nextState = new StateMachineNode($curEntity); $pathNodes[$curPath] = $nextState; $curState->transitions[$macroToken] = $nextState; } } } }