AppEngine DataStore - GQL not returning any result

2019-08-11 08:28发布

$query = "SELECT * FROM Name";

works perfectly as expected but:

$query = "SELECT * FROM Name WHERE name = 'david'";

doesn't work as expected. The DataStore is created as follows:

$obj_name = new Entity();
$obj_name->name = strtolower($name);
$obj_name->age = $age;
$result = $obj_name_store->upsert($obj_name);

Any suggestions for how to extract a specific item using GQL?

Thank you.

1条回答
走好不送
2楼-- · 2019-08-11 08:56

It looks like you are using my php-gds library from here: https://github.com/tomwalder/php-gds

If so, then the problem is likely that you have not explicity requested the "name" property be indexed by Datastore.

When defining your Schema, you need to pass the optional second parameter "TRUE" in order for queries to work against those fields.

See here for a code example.

https://github.com/tomwalder/php-gds#defining-your-model

查看更多
登录 后发表回答