1414 * @link https://pear.php.net/package/contentstack
1515 * */
1616
17- namespace Contentstack \Stack \ ContentType \ BaseQuery ;
17+ namespace Contentstack \Stack ;
1818use Contentstack \Support \Utility ;
1919
20- require_once __DIR__ . "/../../ Support/helper.php " ;
21- require_once __DIR__ . " /../../Support/Utility.php " ;
20+ require_once __DIR__ . "/../Support/helper.php " ;
21+
2222/**
2323 * BaseQuery
2424 * Base Class where all the Queries will be created
@@ -128,7 +128,7 @@ public function only($level = 'BASE', $field_uids = array())
128128 * */
129129 public function includeReference ($ field_uids = array ())
130130 {
131- if (is_array ($ field_uids )) {
131+ if ($ field_uids && is_array ($ field_uids )) {
132132 $ this ->queryObject ->_query = call_user_func (
133133 'contentstackReferences ' ,
134134 'include ' ,
@@ -465,7 +465,7 @@ public function skip($skip = 0)
465465 * */
466466 public function tags ($ tags = array ())
467467 {
468- if (is_array ($ tags )) {
468+ if ($ tags && is_array ($ tags )) {
469469 $ this ->queryObject ->_query = call_user_func (
470470 'contentstackTags ' ,
471471 'tags ' ,
@@ -508,7 +508,7 @@ public function limit($limit = '')
508508 * */
509509 public function containedIn ($ field = '' , $ value = array ())
510510 {
511- if (is_array ($ value )) {
511+ if ($ value && is_array ($ value )) {
512512 $ this ->subQuery = call_user_func (
513513 'contentstackContains ' ,
514514 '$in ' ,
@@ -533,7 +533,7 @@ public function containedIn($field = '', $value = array())
533533 * */
534534 public function notContainedIn ($ field = '' , $ value = array ())
535535 {
536- if (is_array ($ value )) {
536+ if ($ value && is_array ($ value )) {
537537 $ this ->subQuery = call_user_func (
538538 'contentstackContains ' ,
539539 '$nin ' ,
@@ -675,8 +675,8 @@ public function notEqualTo($field = '', $value = '')
675675 * */
676676 public function addQuery ($ _query = array ())
677677 {
678- if (is_array ($ _query )) {
679- $ this ->subQuery = $ _query ;
678+ if ($ _query && is_array ($ _query )) {
679+ $ this ->subQuery = json_encode ( $ _query) ;
680680 return $ this ->queryObject ;
681681 }
682682 throw contentstackCreateError ("Provide valid query " );
0 commit comments