Comments (2)
Im having the same problem.
Any ideas on this one?
class C\A\MicroService
public function handle(string $json) : array
{
$jsonq = new Jsonq();
$jsonq->json($json);
$matchLevel = $jsonq->from('matchLevel')->get();
if($matchLevel != 'Street number'){
throw new \Exception('To low matchLevel, level is ' . $matchLevel );
}
$res = $jsonq->from('products')->get();
return $res;
}
PHP Warning: array_key_exists() expects parameter 2 to be array, string given in /var/app/microservices/vendor/nahid/jsonq/src/JsonQueriable.php on line 334
PHP Stack trace:
PHP 1. {main}() /var/app/microservices/test/index.php:0
PHP 2. C\A\MicroService->handle() /var/app/microservices/test/index.php:23
PHP 3. Nahid\JsonQ\Jsonq->get() /var/app/microservices/src/single.php:48
PHP 4. Nahid\JsonQ\Jsonq->prepare() /var/app/microservices/vendor/nahid/jsonq/src/Jsonq.php:120
PHP 5. Nahid\JsonQ\Jsonq->getData() /var/app/microservices/vendor/nahid/jsonq/src/JsonQueriable.php:135
PHP 6. Nahid\JsonQ\Jsonq->getFromNested() /var/app/microservices/vendor/nahid/jsonq/src/JsonQueriable.php:359
PHP 7. array_key_exists() /var/app/microservices/vendor/nahid/jsonq/src/JsonQueriable.php:334
EDIT:
Made a workaround that "works".
// class C\A\MicroService
public function handle(string $json) : array
{
$jsonq = new Jsonq();
$jsonq->json($json);
// Repeated the object, clone does not work
$jsonq2 = new Jsonq();
// Run json method again.
$jsonq2->json($json);
// Use the second json here
$matchLevel = $jsonq2->from('matchLevel')->get();
if($matchLevel != 'Street number'){
throw new \Exception('To low matchLevel, level is ' . $matchLevel );
}
//Use the first json here
$res = $jsonq->from('products')->get();
return $res;
}
from jsonq.
This issue has been resolved.
https://github.com/nahid/jsonq/releases/tag/v5.2.4
from jsonq.
Related Issues (20)
- foreach() to retrieve records only working once HOT 1
- We can't search the data on LIKE query HOT 4
- how can i get json data from DB ?
- Search with insensitive case ? HOT 2
- How does the macro condition works? HOT 5
- Combining multiple OrWhere to one result in AND HOT 3
- How to use a previous set as a new set to query over those results? HOT 1
- Getting nth data
- hiding api key from clientside
- Can't get whereIn to work HOT 2
- Getting error on Multidimensional array search HOT 3
- Beerpay link is broken HOT 2
- Contains Condition is Case-Sensitive HOT 2
- installation error HOT 4
- Making nested aggregations to compare student result into materials through multiple months
- #HELP How to Use the "Or from a JSON String" HOT 1
- Beerpay website for sponsoring this repo is not working
- Is this still supported?
- PHP deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonq.