21
21
* @method float getY()
22
22
* @method float getHeight()
23
23
* @method float getWidth()
24
- * @method float[] getVector()
25
- * @method setVector(array $vector)
26
24
* @method setX(float $x)
27
25
* @method setY(float $y)
28
26
* @method setHeight(float $height)
29
27
* @method setWidth(float $width)
30
28
* @method setClusterId(int|null $clusterId)
31
29
* @method int|null getClusterId()
32
30
* @method float getThreshold()
33
- * @method setThreshold(float $threshold)
31
+ * @method setThreshold(float $threshold)
34
32
*/
35
33
class FaceDetection extends Entity {
36
34
protected $ fileId ;
@@ -39,17 +37,17 @@ class FaceDetection extends Entity {
39
37
protected $ y ;
40
38
protected $ height ;
41
39
protected $ width ;
42
- protected $ vector ;
40
+ protected $ faceVector ;
43
41
protected $ clusterId ;
44
42
protected $ threshold ;
45
43
/**
46
44
* @var string[]
47
45
*/
48
- public static $ columns = ['id ' , 'user_id ' , 'file_id ' , 'x ' , 'y ' , 'height ' , 'width ' , 'vector ' , 'cluster_id ' , 'threshold ' ];
46
+ public static $ columns = ['id ' , 'user_id ' , 'file_id ' , 'x ' , 'y ' , 'height ' , 'width ' , 'face_vector ' , 'cluster_id ' , 'threshold ' ];
49
47
/**
50
48
* @var string[]
51
49
*/
52
- public static $ fields = ['id ' , 'userId ' , 'fileId ' , 'x ' , 'y ' , 'height ' , 'width ' , 'vector ' , 'clusterId ' , 'threshold ' ];
50
+ public static $ fields = ['id ' , 'userId ' , 'fileId ' , 'x ' , 'y ' , 'height ' , 'width ' , 'faceVector ' , 'clusterId ' , 'threshold ' ];
53
51
54
52
public function __construct () {
55
53
// add types in constructor
@@ -60,19 +58,26 @@ public function __construct() {
60
58
$ this ->addType ('y ' , 'float ' );
61
59
$ this ->addType ('height ' , 'float ' );
62
60
$ this ->addType ('width ' , 'float ' );
63
- $ this ->addType ('vector ' , 'json ' );
61
+ $ this ->addType ('faceVector ' , 'json ' );
64
62
$ this ->addType ('clusterId ' , 'integer ' );
65
63
$ this ->addType ('threshold ' , 'float ' );
66
64
}
67
65
68
66
public function toArray (): array {
69
67
$ array = [];
70
68
foreach (static ::$ fields as $ field ) {
71
- if ($ field === 'vector ' ) {
69
+ if ($ field === 'faceVector ' ) {
72
70
continue ;
73
71
}
74
72
$ array [$ field ] = $ this ->{$ field };
75
73
}
76
74
return $ array ;
77
75
}
76
+
77
+ public function getVector (): array {
78
+ return $ this ->getter ('faceVector ' );
79
+ }
80
+ public function setVector (array $ vector ): void {
81
+ $ this ->setter ('faceVector ' , [$ vector ]);
82
+ }
78
83
}
0 commit comments