@@ -96,10 +96,18 @@ function contentstackUrl($queryObject = '', $type = '') {
9696 $ URL = getDomain ($ queryObject ).ASSETS ;
9797 break ;
9898 default :
99- $ URL = getDomain ($ queryObject ).CONTENT_TYPES .$ queryObject ->contentType ->uid .ENTRIES ;
99+
100+ if ($ queryObject ->_query && $ queryObject ->_query ['include_global_field_schema ' ] || !$ queryObject ->contentType ) {
101+ $ URL = getDomain ($ queryObject ).CONTENT_TYPES .$ queryObject ->uid ;
102+ } else {
103+ $ URL = getDomain ($ queryObject ).CONTENT_TYPES .$ queryObject ->contentType ->uid .ENTRIES ;
104+ }
100105 if (isset ($ queryObject ->entryUid )) $ URL .=$ queryObject ->entryUid ;
101106 }
107+
102108 $ queryParams = generateQueryParams ($ queryObject );
109+ // \Contentstack\Utility\debug(($URL));
110+ // \Contentstack\Utility\debug(($queryParams));
103111 return $ URL .'? ' .$ queryParams ;
104112
105113 }
@@ -218,6 +226,10 @@ function wrapResult($result = '', $queryObject = '') {
218226 $ wrapper = (!$ flag ) ? new Result ($ result ['entry ' ]) : $ result ['entry ' ];
219227 if (isKeySet ($ result , 'asset ' ))
220228 $ wrapper = (!$ flag ) ? new Result ($ result ['asset ' ]) : $ result ['asset ' ];
229+ if (\Contentstack \Utility \isKeySet ($ result , 'schema ' ))
230+ array_push ($ wrapper , $ result ['schema ' ]);
231+ if (\Contentstack \Utility \isKeySet ($ result , 'content_type ' ))
232+ array_push ($ wrapper , $ result ['content_type ' ]);
221233 break ;
222234 case 'find ' :
223235 $ wrapper = array ();
@@ -273,7 +285,6 @@ function contentstackRequest($queryObject = '', $type = ''){
273285 // receive server response ...
274286 curl_setopt ($ http , CURLOPT_RETURNTRANSFER , TRUE );
275287 $ response = curl_exec ($ http );
276-
277288
278289 // status code extraction
279290 $ httpcode = curl_getinfo ($ http , CURLINFO_HTTP_CODE );
0 commit comments