appengineにquercusを使用しています。長いphp文字列(> 1000文字)を保存しようとしましたが、Stringは500文字しか保持できないため、appengineでは許可されません。そこで、appengineのTextデータ型を使用してみました。保存できますが、PHPからデータを取得すると、文字列ではなくresource()型が返されます。
コードで説明しましょう:
<?php
$a = new Text("this is a long string that contains more than 1000 characters");
$b = "this is a long string that contains more than 1000 characters";
$e = new Entity('Article');
$e->setProperty('content', $a); // this works fine
// $e->setProperty('content', $b); // will complain as strlen($b) is > 500
$db = DatastoreServiceFactory::getDatastoreService();
$id = KeyFactory::keyToString($db->put($e)); // works ok, returns the ID of Entity saved
?>
これですべて問題ありませんが、$ eのコンテンツを取得すると、resource()タイプのデータが返されます。
<?php
$q = new Query('Article');
$ps = $db->prepare($q);
foreach($ps->asIterable() as $i) {
echo gettype($i->getProperty('content')); // this will echo Object, which when var_dump'd, gives me a resource() which is not convertible to php string, thus I can't get the human readable value
}
?>
これに対する回避策はありますか?私は何日も髪を引っ張ってきたので、どんな助けでも大歓迎です...