Last active
October 23, 2018 13:18
-
-
Save pilshchikov/b89c6e25f29da88ac03caa42231a02bc to your computer and use it in GitHub Desktop.
Put get enum example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
use Apache\Ignite\Client; | |
use Apache\Ignite\ClientConfiguration; | |
use Apache\Ignite\Type\ObjectType; | |
use Apache\Ignite\Data\EnumItem; | |
$client = new Client(); | |
$ENDPOINT = '127.0.0.1:10800'; | |
$client->connect(new ClientConfiguration($ENDPOINT)); | |
try { | |
$cache1 = $client->getOrCreateCache("P4")->setKeyType(ObjectType::INTEGER)->setValueType(ObjectType::ENUM); | |
$e = new EnumItem(12345); | |
$e->setOrdinal(1); | |
$e->getName(1); | |
$e->getValue(2); | |
$cache1->put(1, $e); | |
$cache2 = $client->getOrCreateCache("P4")->setKeyType(ObjectType::INTEGER); | |
$cache2->get(1); | |
} finally { | |
$client->disconnect(); | |
} | |
//Output: | |
// | |
//$ php /scratch.php | |
// | |
//PHP Fatal error: Uncaught Error: Call to a member function isEnum() on null in [ignite_path]/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryCommunicator.php:268 | |
//Stack trace: | |
//#0 [ignite_path]/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryCommunicator.php(198): Apache\Ignite\Internal\Binary\BinaryCommunicator->readEnum(Object(Apache\Ignite\Internal\Binary\MessageBuffer)) | |
//#1 [ignite_path]/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryCommunicator.php(83): Apache\Ignite\Internal\Binary\BinaryCommunicator->readTypedObject(Object(Apache\Ignite\Internal\Binary\MessageBuffer), 38, NULL) | |
//#2 [ignite_path]/platforms/php/src/Apache/Ignite/Internal/Cache.php(316): Apache\Ignite\Internal\Binary\BinaryCommunicator->readObject(Object(Apache\Ignite\Internal\Binary\MessageBuffer), NULL) | |
//#3 [internal f in [ignite_path]/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryCommunicator.php on line 268 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment