本文整理汇总了PHP中Doctrine_Core::isValidModelClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Core::isValidModelClass方法的具体用法?PHP Doctrine_Core::isValidModelClass怎么用?PHP Doctrine_Core::isValidModelClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Core
的用法示例。
在下文中一共展示了Doctrine_Core::isValidModelClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fixModuleConfig
protected function fixModuleConfig($moduleKey, $moduleConfig, $isInContent)
{
/*
* Extract plural from name
* name | plural
*/
if (!empty($moduleConfig['name'])) {
if (strpos($moduleConfig['name'], '|')) {
list($moduleConfig['name'], $moduleConfig['plural']) = explode('|', $moduleConfig['name']);
}
} else {
$moduleConfig['name'] = dmString::humanize($moduleKey);
}
if (empty($moduleConfig['model'])) {
$candidateModel = dmString::camelize($moduleKey);
$model = class_exists('Base' . $candidateModel, true) ? Doctrine_Core::isValidModelClass($candidateModel) ? $candidateModel : false : false;
} else {
$model = $moduleConfig['model'];
}
// BC "actions" deprecated keyword becomes "components"
if (isset($moduleConfig['actions'])) {
$moduleConfig['components'] = $moduleConfig['actions'];
unset($moduleConfig['actions']);
}
//security features
$securityConfig = $this->fixSecurityConfig($moduleKey, $moduleConfig);
$moduleOptions = array('name' => (string) trim($moduleConfig['name']), 'plural' => (string) trim(empty($moduleConfig['plural']) ? $model ? dmString::pluralize($moduleConfig['name']) : $moduleConfig['name'] : $moduleConfig['plural']), 'model' => $model, 'credentials' => isset($moduleConfig['credentials']) ? is_string($moduleConfig['credentials']) ? trim($moduleConfig['credentials']) : (is_array($moduleConfig['credentials']) ? $moduleConfig['credentials'] : '') : ((bool) $isInContent ? 'content' : null), 'underscore' => (string) dmString::underscore($moduleKey), 'is_project' => (bool) $isInContent || dmArray::get($moduleConfig, 'page', false) || count(dmArray::get($moduleConfig, 'components', array())), 'plugin' => $moduleConfig['plugin'], 'overridden' => dmArray::get($moduleConfig, 'overridden', false), 'has_admin' => (bool) dmArray::get($moduleConfig, 'admin', $model || !$isInContent), 'has_front' => (bool) dmArray::get($moduleConfig, 'front', true), 'components' => dmArray::get($moduleConfig, 'components', array()), 'has_security' => is_array($securityConfig), 'security' => $securityConfig, 'i18n_catalogue' => isset($moduleConfig['i18n_catalogue']) ? $moduleConfig['i18n_catalogue'] : sfConfig::get('dm_i18n_catalogue'));
if ($moduleOptions['is_project']) {
$moduleOptions = array_merge($moduleOptions, array('parent_key' => dmArray::get($moduleConfig, 'parent') ? dmString::modulize(trim(dmArray::get($moduleConfig, 'parent'))) : null, 'has_page' => (bool) dmArray::get($moduleConfig, 'page', false)));
}
// fix non array action filters
foreach ($moduleOptions['components'] as $componentKey => $componentConfig) {
if (is_array($componentConfig) && array_key_exists('filters', $componentConfig) && !is_array($componentConfig['filters'])) {
$moduleOptions['components'][$componentKey]['filters'] = array($componentConfig['filters']);
}
}
return $moduleOptions;
}