7
7
class Space
8
8
{
9
9
private $ mapper ;
10
-
10
+
11
11
private $ id ;
12
12
private $ name ;
13
13
private $ format ;
@@ -38,6 +38,8 @@ public function addProperty($name, $type)
38
38
$ this ->mapper ->getClient ()->evaluate ("box.space[ $ this ->id ]:format(...) " , [$ format ]);
39
39
40
40
$ this ->parseFormat ();
41
+
42
+ return $ this ;
41
43
}
42
44
43
45
public function removeProperty ($ name )
@@ -51,13 +53,17 @@ public function removeProperty($name)
51
53
$ this ->format = $ format ;
52
54
53
55
$ this ->parseFormat ();
56
+
57
+ return $ this ;
54
58
}
55
59
56
60
public function removeIndex ($ name )
57
61
{
58
62
$ this ->mapper ->getClient ()->evaluate ("box.space[ $ this ->id ].index. $ name:drop() " );
59
63
$ this ->indexes = [];
60
64
$ this ->mapper ->getRepository ('_index ' )->flushCache ();
65
+
66
+ return $ this ;
61
67
}
62
68
63
69
public function createIndex ($ config )
@@ -66,7 +72,7 @@ public function createIndex($config)
66
72
if (!is_array ($ config )) {
67
73
$ config = ['fields ' => $ config ];
68
74
}
69
-
75
+
70
76
71
77
if (!array_key_exists ('fields ' , $ config )) {
72
78
if (array_values ($ config ) != $ config ) {
@@ -104,6 +110,7 @@ public function createIndex($config)
104
110
$ this ->mapper ->getClient ()->evaluate ("box.space[ $ this ->id ]:create_index(' $ name', ...) " , [$ options ]);
105
111
$ this ->indexes = [];
106
112
113
+ return $ this ;
107
114
}
108
115
109
116
public function isSpecial ()
@@ -153,6 +160,7 @@ private function parseFormat()
153
160
$ this ->formatTypesHash [$ row ['name ' ]] = $ row ['type ' ];
154
161
$ this ->formatNamesHash [$ row ['name ' ]] = $ key ;
155
162
}
163
+ return $ this ;
156
164
}
157
165
158
166
public function hasProperty ($ name )
@@ -222,7 +230,7 @@ public function castIndex($params)
222
230
$ equals = $ equals && in_array ($ part [0 ], $ keys );
223
231
}
224
232
}
225
-
233
+
226
234
if ($ equals ) {
227
235
return $ index ->iid ;
228
236
}
@@ -313,4 +321,4 @@ public function getRepository()
313
321
}
314
322
return $ this ->repository ?: $ this ->repository = new $ class ($ this );
315
323
}
316
- }
324
+ }
0 commit comments