本文整理汇总了PHP中sfApplicationConfiguration::getConfigPaths方法的典型用法代码示例。如果您正苦于以下问题:PHP sfApplicationConfiguration::getConfigPaths方法的具体用法?PHP sfApplicationConfiguration::getConfigPaths怎么用?PHP sfApplicationConfiguration::getConfigPaths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfApplicationConfiguration
的用法示例。
在下文中一共展示了sfApplicationConfiguration::getConfigPaths方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConfigPaths
/**
* Gets the configuration file paths for a given relative configuration path.
*
* @param string The configuration path
*
* @return array An array of paths
*/
public function getConfigPaths($configPath)
{
// returned in reverse order cascade
// if there is a configuration dimension
if ($this->hasDimension()) {
$cacheKey = sprintf('sf_config_dirs_%s', $configPath);
// if there is a cache return it
if ($this->dimension->getCache()->has($cacheKey)) {
$configs = $this->dimension->getCache()->get($cacheKey);
} else {
// reverse cascade
$dimensions = array_reverse($this->dimension->getCascade());
// $configPath = modules/blah/config/config.yml | config/config.yml
$configDirName = dirname($configPath);
$configFileName = basename($configPath);
$globalConfigPath = basename($configDirName) . '/' . $configFileName;
// config/config.yml
$files = array(sfConfig::get('sf_symfony_lib_dir') . '/config/' . $globalConfigPath);
if ($bundledPluginConfigs = glob(sfConfig::get('sf_symfony_lib_dir') . '/plugins/*/' . $globalConfigPath)) {
$files = array_merge($files, $bundledPluginConfigs);
// bundled plugins
}
if ($pluginConfigs = glob(sfConfig::get('sf_plugins_dir') . '/*/' . $globalConfigPath)) {
foreach ($pluginConfigs as $pluginConfig) {
$configDir = dirname($pluginConfig);
array_push($files, $pluginConfig);
// plugins
foreach ($dimensions as $dimension) {
array_push($files, $configDir . '/' . $dimension . '/' . basename($pluginConfig));
// plugin dimensions
}
}
}
if (is_readable(sfConfig::get('sf_root_dir') . '/' . $globalConfigPath)) {
$configDir = dirname(sfConfig::get('sf_root_dir') . '/' . $globalConfigPath);
array_push($files, sfConfig::get('sf_root_dir') . '/' . $globalConfigPath);
// project
foreach ($dimensions as $dimension) {
array_push($files, $configDir . '/' . $dimension . '/' . basename($globalConfigPath));
// project dimensions
}
}
if (is_readable(sfConfig::get('sf_root_dir') . '/' . $configPath)) {
$configDir = dirname(sfConfig::get('sf_root_dir') . '/' . $configPath);
array_push($files, sfConfig::get('sf_root_dir') . '/' . $configPath);
// project
foreach ($dimensions as $dimension) {
array_push($files, $configDir . '/' . $dimension . '/' . basename($configPath));
// project dimensions
}
}
if (is_readable(sfConfig::get('sf_app_dir') . '/' . $globalConfigPath)) {
$configDir = dirname(sfConfig::get('sf_app_dir') . '/' . $globalConfigPath);
array_push($files, sfConfig::get('sf_app_dir') . '/' . $globalConfigPath);
// application
foreach ($dimensions as $dimension) {
array_push($files, $configDir . '/' . $dimension . '/' . basename($globalConfigPath));
// application dimensions
}
}
array_push($files, sfConfig::get('sf_app_cache_dir') . '/' . $configPath);
// generated modules
if ($pluginConfigs = glob(sfConfig::get('sf_plugins_dir') . '/*/' . $configPath)) {
foreach ($pluginConfigs as $pluginConfig) {
$configDir = dirname($pluginConfig);
array_push($files, $pluginConfig);
// plugins
foreach ($dimensions as $dimension) {
array_push($files, $configDir . '/' . $dimension . '/' . basename($pluginConfig));
// plugin dimensions
}
}
}
if (is_readable(sfConfig::get('sf_app_dir') . '/' . $configPath)) {
$configDir = dirname(sfConfig::get('sf_app_dir') . '/' . $configPath);
array_push($files, sfConfig::get('sf_app_dir') . '/' . $configPath);
// module
foreach ($dimensions as $dimension) {
array_push($files, $configDir . '/' . $dimension . '/' . basename($configPath));
// module
}
}
$configs = array();
$files = array_unique($files);
foreach ($files as $file) {
if (is_readable($file)) {
$configs[] = $file;
}
}
// save cache
$this->dimension->getCache()->set($cacheKey, $configs);
}
} else {
//.........这里部分代码省略.........
示例2: getFactoriesConfiguration
public function getFactoriesConfiguration(sfApplicationConfiguration $appConfiguration)
{
if (is_null($this->config)) {
$this->config = sfFactoryConfigHandler::getConfiguration($appConfiguration->getConfigPaths('config/factories.yml'));
}
return $this->config;
}
示例3: getFactoriesConfiguration
public function getFactoriesConfiguration(sfApplicationConfiguration $appConfiguration)
{
$app = $appConfiguration->getApplication();
$env = $appConfiguration->getEnvironment();
if (!isset($this->config[$app])) {
$this->config[$app] = array();
}
if (!isset($this->config[$app][$env])) {
$this->config[$app][$env] = sfFactoryConfigHandler::getConfiguration($appConfiguration->getConfigPaths('config/factories.yml'));
}
return $this->config[$app][$env];
}
示例4: getConfigPaths
/**
* Gets the configuration file paths for a given relative configuration path.
*
* @param string $configPath The configuration path
*
* @return array An array of paths
*/
public function getConfigPaths($configPath)
{
$globalConfigPath = basename(dirname($configPath)) . '/' . basename($configPath);
$files = array();
if ($libDirs = glob(sfConfig::get('sf_lib_dir') . '/config/' . $configPath)) {
$files = array_merge($files, $libDirs);
// library configurations
}
$files = array_merge($files, $this->globEnablePlugin($configPath, false));
$files = array_merge($files, $this->globEnablePlugin($globalConfigPath, false));
$files = array_merge($files, $this->globEnablePlugin('/apps/' . sfConfig::get('sf_app') . '/' . $globalConfigPath, false));
$files = array_merge($files, $this->globEnablePlugin('/apps/' . sfConfig::get('sf_app') . '/' . $configPath, false));
$configs = array();
foreach (array_unique($files) as $file) {
if (is_readable($file)) {
$configs[] = $file;
}
}
$configs = array_merge(parent::getConfigPaths($configPath), $configs);
return $configs;
}
示例5: getConfigPaths
public function getConfigPaths($configPath)
{
$configs = parent::getConfigPaths($configPath);
usort($configs, array($this, 'sortConfigPaths'));
return $configs;
}