本文整理匯總了PHP中ArrayUtil::isValidArrayIndex方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayUtil::isValidArrayIndex方法的具體用法?PHP ArrayUtil::isValidArrayIndex怎麽用?PHP ArrayUtil::isValidArrayIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil::isValidArrayIndex方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: validateIndexDefinitionsFromSchema
protected static function validateIndexDefinitionsFromSchema(array $indexes, array $columns)
{
$columnNames = RedBeanModelMemberToColumnUtil::resolveColumnNamesArrayFromColumnSchemaDefinition($columns);
foreach ($indexes as $indexName => $index) {
$indexNameLength = strlen($indexName);
if (!is_string($indexName)) {
return static::returnSchemaValidationResult(Zurmo::t('Core', 'Index Name: {{indexName}} is not a string', array('{{indexName}}' => $indexName)));
}
if ($indexNameLength > 64) {
return static::returnSchemaValidationResult(Zurmo::t('Core', 'Index Name: {{indexName}} is {{length}} characters, {{over}} characters over limit(64).', array('{{indexName}}' => $indexName, '{{length}}' => $indexNameLength, '{{over}}' => $indexNameLength - 64)));
}
if (count($index) != 2) {
return static::returnSchemaValidationResult(Zurmo::t('Core', 'Index: {{indexName}} does not have 2 clauses', array('{{indexName}}' => $indexName)));
}
if (!ArrayUtil::isValidArrayIndex('columns', $index)) {
return static::returnSchemaValidationResult(Zurmo::t('Core', 'Index: {{indexName}} does not have indexed column names', array('{{indexName}}' => $indexName)));
}
if (!ArrayUtil::isValidArrayIndex('unique', $index)) {
return static::returnSchemaValidationResult(Zurmo::t('Core', 'Index: {{indexName}} does not have index uniqueness clause defined', array('{{indexName}}' => $indexName)));
}
if (!is_array($index['columns'])) {
return static::returnSchemaValidationResult(Zurmo::t('Core', 'Index: {{indexName}} column definition is not an array', array('{{indexName}}' => $indexName)));
}
foreach ($index['columns'] as $column) {
list($column) = explode('(', $column);
if (!in_array($column, $columnNames)) {
return static::returnSchemaValidationResult(Zurmo::t('Core', 'Index: {{indexName}} column: {{columnName}} does not exist' . ' in current schema definition provided. Columns: {{columns}}', array('{{indexName}}' => $indexName, '{{columnName}}' => $column, '{{columns}}' => print_r($columnNames, true))));
}
}
}
return static::returnSchemaValidationResult(null, true);
}
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:32,代碼來源:CreateOrUpdateExistingTableFromSchemaDefinitionArrayUtil.php