Reputation: 429
I was trying to test this Google Datastore Library for PHP. I have copied the GDS folder to my application's root directory and created a php file in the same root directory. When i run the code I'm getting this error Fatal error: Class 'GDS\Gateway' not found in /home/personal/SampleApp/datastore.php on line 2
datastore.php
<?php
$obj_client = GDS\Gateway::createGoogleClient('AppID', '[email protected]', 'appKeyFile.p12');
$obj_gateway = new GDS\Gateway($obj_client, 'AppID');
$obj_book_store = new GDS\Store($obj_gateway, 'Book');
$obj_book = new GDS\Entity();
$obj_book->title = 'Romeo and Juliet';
$obj_book->author = 'William Shakespeare';
$obj_book->isbn = '1840224339';
$obj_book_store->upsert($obj_book);
?>
Is there anything I'm missing here ?
Upvotes: 2
Views: 254
Reputation: 1412
Did you use composer to pull in the library? If not you'll need to either write your own autoload script or add the following lines
include_once 'src/GDS/Entity.php';
include_once 'src/GDS/Gateway.php';
include_once 'src/GDS/Store.php';
Upvotes: 1