本文整理汇总了PHP中Doctrine_Lib::getValidators方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Lib::getValidators方法的具体用法?PHP Doctrine_Lib::getValidators怎么用?PHP Doctrine_Lib::getValidators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Lib
的用法示例。
在下文中一共展示了Doctrine_Lib::getValidators方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValidators
/**
* getValidators
*
* Retrieve the array of available validators
*
* @return array
*/
public function getValidators()
{
if (empty($this->_validators)) {
$this->_validators = Doctrine_Lib::getValidators();
}
return $this->_validators;
}
示例2: parseSchema
/**
* parseSchema
*
* A method to parse a Schema and translate it into a property array.
* The function returns that property array.
*
* @param string $schema Path to the file containing the schema
* @return array $build Built array of schema information
*/
public function parseSchema($schema, $type)
{
$array = Doctrine_Parser::load($schema, $type);
$build = array();
foreach ($array as $className => $table) {
$columns = array();
$className = isset($table['className']) ? (string) $table['className'] : (string) $className;
if (isset($table['tableName']) && $table['tableName']) {
$tableName = $table['tableName'];
} else {
if (isset($table['inheritance']['extends']) && isset($table['inheritance']['extends']['keyType']) && isset($table['inheritance']['extends']['keyValue'])) {
$tableName = null;
} else {
$tableName = Doctrine::tableize($className);
}
}
$columns = isset($table['columns']) ? $table['columns'] : array();
$columns = isset($table['fields']) ? $table['fields'] : $columns;
if (!empty($columns)) {
foreach ($columns as $columnName => $field) {
$colDesc = array();
$colDesc['name'] = $columnName;
$e = explode('(', $field['type']);
if (isset($e[0]) && isset($e[1])) {
$colDesc['type'] = $e[0];
$colDesc['length'] = substr($e[1], 0, strlen($e[1]) - 1);
} else {
$colDesc['type'] = isset($field['type']) ? (string) $field['type'] : null;
$colDesc['length'] = isset($field['length']) ? (int) $field['length'] : null;
$colDesc['length'] = isset($field['size']) ? (int) $field['size'] : $colDesc['length'];
}
$colDesc['ptype'] = isset($field['ptype']) ? (string) $field['ptype'] : (string) $colDesc['type'];
$colDesc['fixed'] = isset($field['fixed']) ? (int) $field['fixed'] : null;
$colDesc['primary'] = isset($field['primary']) ? (bool) (isset($field['primary']) && $field['primary']) : null;
$colDesc['default'] = isset($field['default']) ? $field['default'] : null;
$colDesc['autoincrement'] = isset($field['autoincrement']) ? (bool) (isset($field['autoincrement']) && $field['autoincrement']) : null;
$colDesc['autoincrement'] = isset($field['autoinc']) ? (bool) (isset($field['autoinc']) && $field['autoinc']) : $colDesc['autoincrement'];
$colDesc['sequence'] = isset($field['sequence']) ? (string) $field['sequence'] : null;
$colDesc['values'] = isset($field['values']) ? (array) $field['values'] : null;
$validators = Doctrine_Lib::getValidators();
foreach ($validators as $validator) {
if (isset($field[$validator])) {
$colDesc[$validator] = $field[$validator];
}
}
$columns[(string) $colDesc['name']] = $colDesc;
}
}
$build[$className]['connection'] = isset($table['connection']) ? $table['connection'] : null;
$build[$className]['className'] = $className;
$build[$className]['tableName'] = $tableName;
$build[$className]['columns'] = $columns;
$build[$className]['relations'] = isset($table['relations']) ? $table['relations'] : array();
$build[$className]['indexes'] = isset($table['indexes']) ? $table['indexes'] : array();
$build[$className]['attributes'] = isset($table['attributes']) ? $table['attributes'] : array();
$build[$className]['templates'] = isset($table['templates']) ? $table['templates'] : array();
$build[$className]['actAs'] = isset($table['actAs']) ? $table['actAs'] : array();
$build[$className]['options'] = isset($table['options']) ? $table['options'] : array();
$build[$className]['package'] = isset($table['package']) ? $table['package'] : null;
if (isset($table['inheritance'])) {
$build[$className]['inheritance'] = $table['inheritance'];
}
}
return $build;
}