本文整理匯總了PHP中org_glizy_ObjectFactory::resolveClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP org_glizy_ObjectFactory::resolveClass方法的具體用法?PHP org_glizy_ObjectFactory::resolveClass怎麽用?PHP org_glizy_ObjectFactory::resolveClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org_glizy_ObjectFactory
的用法示例。
在下文中一共展示了org_glizy_ObjectFactory::resolveClass方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: pathinfo
/**
* @param $className
* @param $application
* @param $parent
* @param $tagName
* @param $id
* @param string $originalId
* @param bool $skipImport
* @param string $mode
* @return mixed
*/
static function &createComponent($className, &$application, &$parent, $tagName, $id, $originalId = '', $skipImport = false, $mode = '')
{
$className = org_glizy_ObjectFactory::resolveClass($className);
$componentClassName = str_replace('.', '_', $className);
if (!class_exists($componentClassName)) {
// controlla se il file className.xml esiste sia nelle classi dell'applicazione
// si in quelle di sistema
// se esiste:
// deve compilarlo e caricarlo
// se non esiste
// deve dare un messaggio di errore
// TODO
// in questo modo non carica eventuali classi dal core
//
// TODO
// deve essere prevista anche la compilazione dei models se sono in PHP e non in XML
//
$fileName = glz_findClassPath($className);
$pathInfo = pathinfo($fileName);
if (empty($pathInfo['basename'])) {
trigger_error($className . ': component file not found', E_USER_ERROR);
}
if ($pathInfo['extension'] == 'xml') {
/** @var org_glizy_compilers_Component $compiler */
$compiler = org_glizy_ObjectFactory::createObject('org.glizy.compilers.Component');
$compiledFileName = $compiler->verify($fileName, array('originalClassName' => $className, 'mode' => $mode));
require_once $compiledFileName;
$componentClassName = glz_basename($compiledFileName);
} else {
require_once $fileName;
}
$newObj = new $componentClassName($application, $parent, $tagName, $id, $originalId, $skipImport);
return $newObj;
}
$newObj = new $componentClassName($application, $parent, $tagName, $id, $originalId, $skipImport);
return $newObj;
}