@@ -50,8 +50,11 @@ public function toJSON() {
5050 * @return Query
5151 * */
5252 public function except ($ level = 'BASE ' , $ field_uids = array ()) {
53- $ this ->queryObject ->_query = call_user_func ('contentstackProjection ' , 'except ' , $ this ->queryObject ->_query , $ level , $ field_uids );
54- return $ this ->queryObject ;
53+ if ($ field_uids && is_array ($ field_uids )) {
54+ $ this ->queryObject ->_query = call_user_func ('contentstackProjection ' , 'except ' , $ this ->queryObject ->_query , $ level , $ field_uids );
55+ return $ this ->queryObject ;
56+ }
57+ throw contentstackCreateError ('field_uids must be an array ' );
5558 }
5659
5760 /*
@@ -61,8 +64,11 @@ public function except($level = 'BASE', $field_uids = array()) {
6164 * @return Query
6265 * */
6366 public function only ($ level = 'BASE ' , $ field_uids = array ()) {
64- $ this ->queryObject ->_query = call_user_func ('contentstackProjection ' , 'only ' , $ this ->queryObject ->_query , $ level , $ field_uids );
65- return $ this ->queryObject ;
67+ if ($ field_uids && is_array ($ field_uids )) {
68+ $ this ->queryObject ->_query = call_user_func ('contentstackProjection ' , 'only ' , $ this ->queryObject ->_query , $ level , $ field_uids );
69+ return $ this ->queryObject ;
70+ }
71+ throw contentstackCreateError ('field_uids must be an array ' );
6672 }
6773
6874 /*
@@ -72,8 +78,11 @@ public function only($level = 'BASE', $field_uids = array()) {
7278 * @return Query
7379 * */
7480 public function includeReference ($ field_uids = array ()) {
75- $ this ->queryObject ->_query = call_user_func ('contentstackReferences ' , 'include ' , $ this ->queryObject ->_query , $ field_uids );
76- return $ this ->queryObject ;
81+ if ($ field_uids && is_array ($ field_uids )) {
82+ $ this ->queryObject ->_query = call_user_func ('contentstackReferences ' , 'include ' , $ this ->queryObject ->_query , $ field_uids );
83+ return $ this ->queryObject ;
84+ }
85+ throw contentstackCreateError ('field_uids must be an array ' );
7786 }
7887
7988 /*
@@ -287,8 +296,11 @@ public function skip($skip = 0) {
287296 * @return Query
288297 * */
289298 public function tags ($ tags = array ()) {
290- $ this ->queryObject ->_query = call_user_func ('contentstackTags ' , 'tags ' , $ this ->queryObject ->_query , $ tags );
291- return $ this ->queryObject ;
299+ if ($ tags && is_array ($ tags )) {
300+ $ this ->queryObject ->_query = call_user_func ('contentstackTags ' , 'tags ' , $ this ->queryObject ->_query , $ tags );
301+ return $ this ->queryObject ;
302+ }
303+ throw contentstackCreateError ('tags must be an array ' );
292304 }
293305
294306 /*
@@ -313,8 +325,11 @@ public function limit($limit = '') {
313325 * @return Query
314326 * */
315327 public function containedIn ($ field = '' , $ value = array ()) {
316- $ this ->subQuery = call_user_func ('contentstackContains ' , '$in ' , $ this ->subQuery , $ field , $ value );
317- return $ this ->queryObject ;
328+ if ($ value && is_array ($ value )) {
329+ $ this ->subQuery = call_user_func ('contentstackContains ' , '$in ' , $ this ->subQuery , $ field , $ value );
330+ return $ this ->queryObject ;
331+ }
332+ throw contentstackCreateError ('value must be an array ' );
318333 }
319334
320335 /*
@@ -326,8 +341,11 @@ public function containedIn($field = '', $value = array()) {
326341 * @return Query
327342 * */
328343 public function notContainedIn ($ field = '' , $ value = array ()) {
329- $ this ->subQuery = call_user_func ('contentstackContains ' , '$nin ' , $ this ->subQuery , $ field , $ value );
330- return $ this ->queryObject ;
344+ if ($ value && is_array ($ value )) {
345+ $ this ->subQuery = call_user_func ('contentstackContains ' , '$nin ' , $ this ->subQuery , $ field , $ value );
346+ return $ this ->queryObject ;
347+ }
348+ throw contentstackCreateError ('value must be an array ' );
331349 }
332350
333351 /*
0 commit comments