I need to get a sub entity from the key of parent. I dont know even if its possible. But what I tried is as following:
public function get_service_details(){
$datastore = new Google\Cloud\Datastore\DatastoreClient(['projectId' => $this->config->item('google_project_id')]);
$key = $datastore->key($this->entity_kind);
$key->ancestor($this->parent_kind, $this->parent_key);
$server_config_details = $datastore->lookup($key);
return $server_config_details;
}
and
public function get_service_details(){
$datastore = new Google\Cloud\Datastore\DatastoreClient(['projectId' => $this->config->item('google_project_id')]);
$ancestorKey = $datastore->key($this->parent_kind, $this->parent_key);
$query = $datastore->query()
->kind($this->entity_kind)
->hasAncestor($ancestorKey);
$server_config_details = $datastore->runQuery($query);
return $server_config_details;
}
But in both of the above cases it returned me nothing. Can you please tell me what am I missing?