protected function _getTypes($table, $fields)
    {
        $types = [];
        $schema = $table->getSchema();
        $map = array_keys((array)Type::getMap() + ['string' => 1, 'text' => 1, 'boolean' => 1]);
        $typeMap = array_combine(
            $map,
            array_map(['Cake\Database\Type', 'build'], $map)
        );

        foreach (['string', 'text'] as $t) {
            if (get_class($typeMap[$t]) === 'Cake\Database\Type') {
                unset($typeMap[$t]);
            }
        }

        foreach (array_intersect($fields, $schema->columns()) as $col) {
            $typeName = $schema->getColumnType($col);
            if (isset($typeMap[$typeName])) {
                $types[$col] = $typeMap[$typeName];
            }
        }

        return $types;
    }