Following the basic 3.0 PHP DSK i have the following code which is below. I am able to run basic Key operations but when i try to run the N1Ql query it fails, with the following error"
PHP Fatal error: Uncaught Error: Class ‘CouchbaseN1qlQuery’ not found in /var/www/html/test.php:18
I also tried the old way which didn’t work either
$query = \Couchbase\N1qlquery::fromString('SELECT i FROM rets AS r UNNEST r.Images AS i WHERE r._type ="Residential" AND i.MediaKey = $mediaKey');
$connectionString = "couchbase://127.0.0.1";
$options = new \Couchbase\ClusterOptions();
$options->credentials("Administrator", "Password");
$cluster = new \Couchbase\Cluster($connectionString, $options);
// get a bucket reference
$bucket = $cluster->bucket("rets");
// get a collection reference
$collection = $bucket->defaultCollection();
$res = $collection->get("OpenHouse::00056d98-fb45-464d-8fc1-62e2919833dd");
$doc = $res->content();
printf("document \"document-key\" has content: \"%s\" CAS \"%s\"\n", json_encode($doc), $res->cas());
$query = CouchbaseN1qlQuery::fromString('SELECT i FROM rets AS r UNNEST r.Images AS i WHERE r._type ="Residential" AND i.MediaKey = $mediaKey');
$query->namedParams(array('mediaKey' => '2AF97A30-42F7-4E08-8BF6-020316D6F161'));
$result = $bucket->query($query);
print_r($result);