-
Notifications
You must be signed in to change notification settings - Fork 0
/
Error.php
47 lines (39 loc) · 979 Bytes
/
Error.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
declare(strict_types=1);
/*
* This file is part of the QuidPHP package <https://quidphp.com>
* Author: Pierre-Philippe Emond <emondpph@gmail.com>
* License: https://github.com/quidphp/core/blob/master/LICENSE
*/
namespace Quid\Core\Col;
use Quid\Base;
use Quid\Core;
use Quid\Orm;
// error
// class for a column that manages an error object
class Error extends Core\ColAlias
{
// config
protected static array $config = [
'general'=>true,
'editable'=>false,
'complex'=>'div',
'onComplex'=>true,
'check'=>['kind'=>'text']
];
// onGet
// sur onGet recrée l'objet error si c'est du json
protected function onGet($return,?Orm\Cell $cell,array $option)
{
if(is_scalar($return))
{
$json = Base\Json::decode($return);
if(!empty($json))
$return = Core\Error::newOverload($json);
}
return $return;
}
}
// init
Error::__init();
?>