@@ -20,19 +20,16 @@ public function __construct($data = '', $parent = '') {
2020 $ this ->queryObject ->_query = array ();
2121 $ this ->subQuery = array ();
2222 }elseif ($ data ->type === 'asset ' ){
23- $ this ->asset = $ data ;
24- $ this ->queryObject = $ data ;
23+ $ this ->stack = $ data ;
24+ $ this ->queryObject = $ parent ;
2525 $ this ->queryObject ->_query = array ();
26- $ this ->subQuery = array ();
27- }
28- else {
26+ $ this ->subQuery = array ();
27+ }else {
2928 $ this ->contentType = $ data ;
3029 $ this ->queryObject = $ parent ;
3130 $ this ->queryObject ->_query = array ();
32- $ this ->subQuery = array ();
33-
31+ $ this ->subQuery = array ();
3432 }
35-
3633 }
3734
3835 /*
@@ -63,7 +60,7 @@ public function except($level = 'BASE', $field_uids = array()) {
6360 * @return Query
6461 * */
6562 public function only ($ level = 'BASE ' , $ field_uids = array ()) {
66- $ this ->queryObject ->_query = call_user_func ('contentstackProjection ' , 'only ' , $ this ->queryObject ->_query , $ level , $ field_uids );
63+ $ this ->queryObject ->_query = call_user_func ('contentstackProjection ' , 'only ' , $ this ->queryObject ->_query , $ level , $ field_uids );
6764 return $ this ->queryObject ;
6865 }
6966
@@ -233,6 +230,18 @@ public function includeOwner() {
233230 return $ this ->queryObject ;
234231 }
235232
233+ /*
234+ * addParam
235+ * To sort the entries in addParam
236+ * @param
237+ * field_uid - field uid to be sorted
238+ * @return Query
239+ * */
240+ public function addParam ($ key = '' , $ value = '' ) {
241+ $ this ->queryObject ->_query = call_user_func ('contentstackAddParam ' , $ key , $ this ->queryObject ->_query , $ value );
242+ return $ this ->queryObject ;
243+ }
244+
236245 /*
237246 * language
238247 * To set the language code in the query
@@ -403,7 +412,5 @@ public function getQuery() {
403412 } catch (\Exception $ e ) {
404413 echo $ e ->getMessage ();
405414 }
406- }
407-
408-
415+ }
409416}
0 commit comments