【发布时间】:2022-01-03 17:38:27
【问题描述】:
即使在src/Database/StatementInterface.php 中,函数fetch 和fetchAll 也有这些注释:
$statement = $connection->prepare('SELECT id, title from articles');
$statement->execute();
print_r($statement->fetchAll('assoc')); // will show [0 => ['id' => 1, 'title' => 'a title']]
函数将ALL字段返回为string,甚至字段都定义为数字:
array(4) {
["lat"]=>
string(11) "38.49580000"
["lng"]=>
string(11) "-6.95301000"
["taken_at"]=>
string(19) "2021-03-30 16:24:30"
["id"]=>
string(1) "1
lat 和 lng 字段定义为 DECIMAL(10,8)|(11,8),id 定义为 INTEGER。 CakePHP 4.3.1 [以及以前的版本] 将字段返回为 string,这会破坏代码。
是我做错了什么还是这是一个错误?
【问题讨论】:
标签: cakephp