本文整理汇总了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