Код: Выделить всё
+----------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| account_number | varchar(20) | NO | | NULL | |
| photo | text | YES | | NULL | |
| isDefault | tinyint(1) | YES | | 0 | |
+----------------+-------------+------+-----+---------+----------------+
Код: Выделить всё
Код: Выделить всё
object(RedBeanPHP\OODBBean)#17 (11) {
["properties":protected]=>
array(4) {
["id"]=>
string(1) "1"
["account_number"]=>
string(10) "1234567890"
["photo"]=>
string(17) "sample_photo_data"
["isDefault"]=>
string(1) "0"
}
["__info":protected]=>
array(8) {
["type"]=>
string(6) "photos"
["sys.id"]=>
string(2) "id"
["sys.orig"]=>
array(4) {
["id"]=>
string(1) "1"
["account_number"]=>
string(10) "1234567890"
["photo"]=>
string(17) "sample_photo_data"
["isDefault"]=>
string(1) "0"
}
["tainted"]=>
bool(false)
["changed"]=>
bool(false)
["changelist"]=>
array(0) {
}
["model"]=>
NULL
["data.bundle"]=>
array(0) {
}
}
["beanHelper":protected]=>
object(RedBeanPHP\BeanHelper\SimpleFacadeBeanHelper)#13 (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)
["castProperty":protected]=>
NULL
}
Код: Выделить всё
{"id":1,"account_number":"1234567890","photo":"sample_photo_data","isDefault":"0","is_default":0}
- Если я не проведу кастинг обоих id и isDefault возвращают тип String, разве они не должны иметь тип int?
- Приведение работает для id, но не для isDefault . При преобразовании isDefault вместо этого воссоздается другой столбец is_default.
Подробнее здесь: https://stackoverflow.com/questions/786 ... -as-string