Skip to content
Permalink
Browse files

Fixing batch casting

  • Loading branch information...
lorenzo committed Mar 5, 2018
1 parent 1c04732 commit ca23d3f4775aaea068fa263cd1bb4a5a6e33b94c
Showing with 6 additions and 18 deletions.
  1. +2 −2 src/Database/FieldTypeConverter.php
  2. +2 −8 src/Database/Type/DecimalType.php
  3. +2 −8 src/Database/Type/IntegerType.php
@@ -82,8 +82,8 @@ public function __construct(TypeMap $typeMap, Driver $driver)
// the interface. Users can implement the TypeInterface instead to have
// access to this feature.
$batchingType = $type instanceof BatchCastingInterface &&
$type instanceof Type &&
strpos(get_class($type), 'Cake\Database\Type') === false;
!($type instanceof Type &&
strpos(get_class($type), 'Cake\Database\Type') === false);
if ($batchingType) {
$batchingMap[$k] = $type;
@@ -107,10 +107,7 @@ public function toPHP($value, Driver $driver)
return $value;
}
// Using coercion is faster than casting
// @codingStandardsIgnoreStart
return (float)+$value;
// @codingStandardsIgnoreEnd
return (float)$value;
}
/**
@@ -125,10 +122,7 @@ public function manyToPHP(array $values, array $fields, Driver $driver)
continue;
}
// Using coercion is faster than casting
// @codingStandardsIgnoreStart
$values[$field] = (float)+$values[$field];
// @codingStandardsIgnoreEnd
$values[$field] = (float)$values[$field];
}
return $values;
@@ -87,10 +87,7 @@ public function toPHP($value, Driver $driver)
return $value;
}
// Using coercion is faster than casting
// @codingStandardsIgnoreStart
return (int)+$value;
// @codingStandardsIgnoreEnd
return (int)$value;
}
/**
@@ -104,10 +101,7 @@ public function manyToPHP(array $values, array $fields, Driver $driver)
if (!isset($values[$field])) {
continue;
}
// Using coercion is faster than casting
// @codingStandardsIgnoreStart
$values[$field] = (int)+$values[$field];
// @codingStandardsIgnoreEnd
$values[$field] = (int)$values[$field];
}
return $values;

0 comments on commit ca23d3f

Please sign in to comment.
You can’t perform that action at this time.