Problem getting N1QL to run in PHP with SDK 3.0

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);

Try $cluster->query() https://docs.couchbase.com/php-sdk/current/project-docs/migrating-sdk-code-to-3.n.html#query

Thanks i was able to make it work now via the below. For some reason there is no direct info on using N1QL in the SDK 3.0 version.

$options = new \Couchbase\QueryOptions();
$options->namedParameters(['mediaKey' => '2AF97A30-42F7-4E08-8BF6-020316D6F161']);
$result = $cluster->query('SELECT i FROM rets AS r UNNEST r.Images AS i WHERE r._type ="Residential" AND i.MediaKey = $mediaKey', $options);
print_r($result);

Hi @aponnath did you see if this doc help

VSR info did trick , part of the issue for me is still the lack of docs. When you search for stuff you will find stuff which does not clearly specify which version it applies to and if you start from scratch you might not look in the migration docs