-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSet.php
More file actions
53 lines (43 loc) · 1.12 KB
/
Set.php
File metadata and controls
53 lines (43 loc) · 1.12 KB
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
48
49
50
51
52
53
<?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;
// set
// class for a column containing a set relation (many)
class Set extends RelationAlias
{
// config
protected static array $config = [
'cell'=>Core\Cell\Set::class,
'preValidate'=>'array',
'filterMethod'=>'or|findInSet',
'set'=>true,
'complex'=>[0=>'checkbox',11=>'search'],
'check'=>['kind'=>'text']
];
// isSet
// retourne vrai comme la colonne est de type relation set
final public function isSet():bool
{
return true;
}
// onGet
// sur get de la valeur de relation
protected function onGet($return,?Orm\Cell $cell,array $option)
{
$return = parent::onGet($return,$cell,$option);
if(is_scalar($return))
$return = Base\Set::arr($return,['cast'=>true]);
return $return;
}
}
// init
Set::__init();
?>