And a here we go again
Добавляем простое текстовое поле для хранения данных в формате json и что бы не конвертировать каждый раз, добавляю обработчики для этого.
Однако в итоге получаю все тот-же "Array" на выходе за 4 года починить не могут или кто-то там все время ломает одно и тоже?
[CODE]new Entity\TextField('CONTENT', [
'save_data_modification' => function () {
return [
function ($data) {
$response = '';
try {
$response = json_encode($data, JSON_THROW_ON_ERROR);
} catch (\Exception $exception) {
Helper::writeLog('/ElementHistoryTable.log', print_r(
[
'save_data_modification',
'message'=>$exception->getMessage(),
'code'=>$exception->getCode()
]
));
}
return $response;
}
];
},
'fetch_data_modification' => function () {
return [
function ($data) {
$response = [];
try {
$response = json_decode($data, true);
} catch (\Exception $exception) {
Helper::writeLog('/ElementHistoryTable.log', print_r(
[
'fetch_data_modification',
'message'=>$exception->getMessage(),
'code'=>$exception->getCode()
]
));
}
return $response;
}
];
},
]
),
[/CODE]
Добавляем простое текстовое поле для хранения данных в формате json и что бы не конвертировать каждый раз, добавляю обработчики для этого.
Однако в итоге получаю все тот-же "Array" на выходе за 4 года починить не могут или кто-то там все время ломает одно и тоже?
[CODE]new Entity\TextField('CONTENT', [
'save_data_modification' => function () {
return [
function ($data) {
$response = '';
try {
$response = json_encode($data, JSON_THROW_ON_ERROR);
} catch (\Exception $exception) {
Helper::writeLog('/ElementHistoryTable.log', print_r(
[
'save_data_modification',
'message'=>$exception->getMessage(),
'code'=>$exception->getCode()
]
));
}
return $response;
}
];
},
'fetch_data_modification' => function () {
return [
function ($data) {
$response = [];
try {
$response = json_decode($data, true);
} catch (\Exception $exception) {
Helper::writeLog('/ElementHistoryTable.log', print_r(
[
'fetch_data_modification',
'message'=>$exception->getMessage(),
'code'=>$exception->getCode()
]
));
}
return $response;
}
];
},
]
),
[/CODE]