File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change 1111 * @version 2.2
1212 *
1313 * @method int count ()
14+ * @method dbObject ArrayBuilder()
15+ * @method dbObject JsonBuilder()
16+ * @method dbObject ObjectBuilder()
1417 * @method mixed byId (string $id, mixed $fields)
1518 * @method mixed get (mixed $limit, mixed $fields)
1619 * @method mixed getOne (mixed $fields)
@@ -181,21 +184,19 @@ public function __unset ($name) {
181184 *
182185 * @return dbObject
183186 */
184- public static function JsonBuilder () {
185- $ obj = new static ;
186- $ obj ->returnType = 'Json ' ;
187- return $ obj ;
187+ private function JsonBuilder () {
188+ $ this ->returnType = 'Json ' ;
189+ return $ return ;
188190 }
189191
190192 /**
191193 * Helper function to create dbObject with Array return type
192194 *
193195 * @return dbObject
194196 */
195- public static function ArrayBuilder () {
196- $ obj = new static ;
197- $ obj ->returnType = 'Array ' ;
198- return $ obj ;
197+ private function ArrayBuilder () {
198+ $ this ->returnType = 'Array ' ;
199+ return $ this ;
199200 }
200201
201202 /**
@@ -204,8 +205,9 @@ public static function ArrayBuilder () {
204205 *
205206 * @return dbObject
206207 */
207- public static function ObjectBuilder () {
208- return new static ;
208+ private function ObjectBuilder () {
209+ $ this ->returnType = 'Object ' ;
210+ return $ this ;
209211 }
210212
211213 /**
Original file line number Diff line number Diff line change @@ -141,6 +141,12 @@ function createTable ($name, $data) {
141141 exit ;
142142}
143143
144+ $ products = product::with ('userId ' )->ArrayBuilder ()->get (2 );
145+ if (!is_array ($ products [0 ]['userId ' ]) || !is_array ($ products [1 ]['userId ' ])) {
146+ echo "Error in with processing in get " ;
147+ exit ;
148+ }
149+
144150$ depts = product::join ('user ' )->orderBy ('`products`.id ' , 'desc ' )->get (5 );
145151foreach ($ depts as $ d ) {
146152 if (!is_object ($ d )) {
You can’t perform that action at this time.
0 commit comments