本文整理汇总了PHP中Cake\Database\Type::buildAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::buildAll方法的具体用法?PHP Type::buildAll怎么用?PHP Type::buildAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Database\Type
的用法示例。
在下文中一共展示了Type::buildAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Builds the type map
*
* @param \Cake\Database\TypeMap $typeMap Contains the types to use for converting results
* @param \Cake\Database\Driver $driver The driver to use for the type conversion
*/
public function __construct(TypeMap $typeMap, Driver $driver)
{
$this->_driver = $driver;
$map = $typeMap->toArray();
$types = Type::buildAll();
$result = [];
foreach ($types as $k => $type) {
if ($type instanceof OptionalConvertInterface && !$type->requiresToPhpCast()) {
unset($types[$k]);
}
}
foreach ($map as $field => $type) {
if (isset($types[$type])) {
$result[$field] = $types[$type];
}
}
$this->_typeMap = $result;
}