本文整理汇总了PHP中Prado::setPathOfAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP Prado::setPathOfAlias方法的具体用法?PHP Prado::setPathOfAlias怎么用?PHP Prado::setPathOfAlias使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prado
的用法示例。
在下文中一共展示了Prado::setPathOfAlias方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importZendNamespace
protected function importZendNamespace()
{
if (is_null(Prado::getPathOfAlias('Zend'))) {
$zendBase = !is_null($this->_ZF) ? $this->_ZF . '.*' : 'Application.index.*';
$path = !is_null($this->_ZF) ? $this->_ZF . '.Zend.*' : 'Application.index.Zend.*';
Prado::using($zendBase);
Prado::setPathOfAlias('Zend', Prado::getPathOfNamespace($path));
}
}
示例2: testSetTransformPathAsNamespace
public function testSetTransformPathAsNamespace()
{
if (Prado::getPathOfAlias('UnitTest') === null) {
Prado::setPathOfAlias('UnitTest', dirname(__FILE__) . '/data');
}
$expected = $this->transformPath;
$transform = new TXmlTransform();
$transform->setTransformPath('UnitTest.hello');
$this->assertEquals($expected, $transform->getTransformPath());
}
示例3: __construct
function __construct($root, $app_dir = '.')
{
$this->_root = $root;
Prado::setPathOfAlias('Tests', $root);
if ($app_dir === null) {
$app_dir = '.';
}
$app = new TShellApplication($app_dir);
$app->run();
}
示例4: applyConfiguration
public function applyConfiguration($config, $withinService = false)
{
if ($config->getIsEmpty()) {
return;
}
foreach ($config->getAliases() as $alias => $path) {
Prado::setPathOfAlias($alias, $path);
}
foreach ($config->getUsings() as $using) {
Prado::using($using);
}
if (!$withinService) {
foreach ($config->getProperties() as $name => $value) {
$this->setSubProperty($name, $value);
}
}
if (empty($this->_services)) {
$this->_services = array($this->getPageServiceID() => array('TPageService', array(), null));
}
foreach ($config->getParameters() as $id => $parameter) {
if (is_array($parameter)) {
$component = Prado::createComponent($parameter[0]);
foreach ($parameter[1] as $name => $value) {
$component->setSubProperty($name, $value);
}
$this->_parameters->add($id, $component);
} else {
$this->_parameters->add($id, $parameter);
}
}
$modules = array();
foreach ($config->getModules() as $id => $moduleConfig) {
if (!is_string($id)) {
$id = '_module' . count($this->_lazyModules);
}
$this->_lazyModules[$id] = $moduleConfig;
if ($module = $this->internalLoadModule($id)) {
$modules[] = $module;
}
}
foreach ($modules as $module) {
$module[0]->init($module[1]);
}
foreach ($config->getServices() as $serviceID => $serviceConfig) {
$this->_services[$serviceID] = $serviceConfig;
}
foreach ($config->getExternalConfigurations() as $filePath => $condition) {
if ($condition !== true) {
$condition = $this->evaluateExpression($condition);
}
if ($condition) {
if (($path = Prado::getPathOfNamespace($filePath, $this->getConfigurationFileExt())) === null || !is_file($path)) {
throw new TConfigurationException('application_includefile_invalid', $filePath);
}
$cn = $this->getApplicationConfigurationClass();
$c = new $cn();
$c->loadFromFile($path);
$this->applyConfiguration($c, $withinService);
}
}
}
示例5: applyConfiguration
/**
* Applies an application configuration.
* @param TApplicationConfiguration the configuration
* @param boolean whether the configuration is specified within a service.
*/
public function applyConfiguration($config, $withinService = false)
{
if ($config->getIsEmpty()) {
return;
}
// set path aliases and using namespaces
foreach ($config->getAliases() as $alias => $path) {
Prado::setPathOfAlias($alias, $path);
}
foreach ($config->getUsings() as $using) {
Prado::using($using);
}
// set application properties
if (!$withinService) {
foreach ($config->getProperties() as $name => $value) {
$this->setSubProperty($name, $value);
}
}
if (empty($this->_services)) {
$this->_services = array($this->getPageServiceID() => array('TPageService', array(), null));
}
// load parameters
foreach ($config->getParameters() as $id => $parameter) {
if (is_array($parameter)) {
$component = Prado::createComponent($parameter[0]);
foreach ($parameter[1] as $name => $value) {
$component->setSubProperty($name, $value);
}
$this->_parameters->add($id, $component);
} else {
$this->_parameters->add($id, $parameter);
}
}
// load and init modules specified in app config
$modules = array();
foreach ($config->getModules() as $id => $moduleConfig) {
Prado::trace("Loading module {$id} ({$moduleConfig[0]})", 'System.TApplication');
list($moduleClass, $initProperties, $configElement) = $moduleConfig;
$module = Prado::createComponent($moduleClass);
if (!is_string($id)) {
$id = '_module' . count($this->_modules);
$initProperties['id'] = $id;
}
$this->setModule($id, $module);
foreach ($initProperties as $name => $value) {
$module->setSubProperty($name, $value);
}
$modules[] = array($module, $configElement);
}
foreach ($modules as $module) {
$module[0]->init($module[1]);
}
// load service
foreach ($config->getServices() as $serviceID => $serviceConfig) {
$this->_services[$serviceID] = $serviceConfig;
}
// external configurations
foreach ($config->getExternalConfigurations() as $filePath => $condition) {
if ($condition !== true) {
$condition = $this->evaluateExpression($condition);
}
if ($condition) {
if (($path = Prado::getPathOfNamespace($filePath, self::CONFIG_FILE_EXT)) === null || !is_file($path)) {
throw new TConfigurationException('application_includefile_invalid', $filePath);
}
$c = new TApplicationConfiguration();
$c->loadFromFile($path);
$this->applyConfiguration($c, $withinService);
}
}
}