function createKeyForTestItem()
{
    $path = new Google_Service_Datastore_KeyPathElement();
    $path->setKind("testkind");
    $path->setName("testkeyname");
    $key = DatastoreService::getInstance()->createKey();
    $key->setPath([$path]);
    return $key;
}
 /**
  * Generate the Key for the item.
  * @param $item
  */
 protected static function createKeyForItem($item)
 {
     $path = new Google_Service_Datastore_KeyPathElement();
     $path->setKind($item->getKindName());
     // Sanity check
     if ($item->key_id !== null && $item->key_name !== null) {
         throw new UnexpectedValueException('Only one of key_id or key_name should be set.');
     }
     if ($item->key_id !== null) {
         $path->setId($item->key_id);
     } else {
         if ($item->key_name !== null) {
             $path->setName($item->key_name);
         }
     }
     $key = DatastoreService::getInstance()->createKey();
     $key->setPath([$path]);
     return $key;
 }