每当我var_dump一个bean时,所有字段都是字符串。这是预期的行为吗?我希望能够json_encode()我的bean并保留每个字段的类型,而不是每个值都在引号(字符串)中。
的var_dump($豆)
array(2) {
[1]=>
object(RedBeanPHP\OODBBean)#418 (10) {
["properties":protected]=>
array(3) {
["id"]=>
string(1) "1"
["name"]=>
string(14) "United Kingdom"
["code"]=>
string(2) "GB"
}
["__info":protected]=>
array(5) {
["type"]=>
string(7) "country"
["sys.id"]=>
string(2) "id"
["sys.orig"]=>
array(3) {
["id"]=>
string(1) "1"
["name"]=>
string(14) "United Kingdom"
["code"]=>
string(2) "GB"
}
["tainted"]=>
bool(false)
["changed"]=>
bool(false)
}
["beanHelper":protected]=>
object(RedBeanPHP\BeanHelper\SimpleFacadeBeanHelper)#12 (0) {
}
["fetchType":protected]=>
NULL
["withSql":protected]=>
string(0) ""
["withParams":protected]=>
array(0) {
}
["aliasName":protected]=>
NULL
["via":protected]=>
NULL
["noLoad":protected]=>
bool(false)
["all":protected]=>
bool(false)
}
[2]=>
object(RedBeanPHP\OODBBean)#406 (10) {
["properties":protected]=>
array(3) {
["id"]=>
string(1) "2"
["name"]=>
string(9) "Singapore"
["code"]=>
string(2) "SG"
}
["__info":protected]=>
array(5) {
["type"]=>
string(7) "country"
["sys.id"]=>
string(2) "id"
["sys.orig"]=>
array(3) {
["id"]=>
string(1) "2"
["name"]=>
string(9) "Singapore"
["code"]=>
string(2) "SG"
}
["tainted"]=>
bool(false)
["changed"]=>
bool(false)
}
["beanHelper":protected]=>
object(RedBeanPHP\BeanHelper\SimpleFacadeBeanHelper)#12 (0) {
}
["fetchType":protected]=>
NULL
["withSql":protected]=>
string(0) ""
["withParams":protected]=>
array(0) {
}
["aliasName":protected]=>
NULL
["via":protected]=>
NULL
["noLoad":protected]=>
bool(false)
["all":protected]=>
bool(false)
}
}