/** * Extract the results of a Datastore query into FeedModel objects * @param $results Datastore query results */ protected static function extractQueryResults($results) { $query_results = []; foreach ($results as $result) { $id = @$result['entity']['key']['path'][0]['id']; $key_name = @$result['entity']['key']['path'][0]['name']; $props = $result['entity']['properties']; $visits = $props[self::D_AMOUNT]->getStringValue(); $blog_model = new foo($visits); $blog_model->setKeyId($id); $blog_model->setKeyName($key_name); // Cache this read feed. $blog_model->onItemWrite(); $query_results[] = $blog_model; } return $query_results; }