php-ext-unqlite
php-ext-unqlite copied to clipboard
Error Accessing Collection that Does Not Exist
When attempting to access a collection that does not exist, PHP throws an uncaught error shown below:
</b>Fatal error:</b> Uncaught exception 'UnQLite\Exception' with message 'unable to init UnQLite\Doc' in ...:30
stack trace:
#0 /.../*.php(30): UnQLite\DB->doc('nonExistentCollection')
#1 {main}
Is there any method to determine if a collection exists before trying to access the collection? Or can you instead return an error if the collection does not exist?
What running source?
<?php
namespace UnQLite;
$db = new DB('test.db');
var_dump($db);
$doc = $db->doc('test-1');
var_dump($doc);
// output:
/*
object(UnQLite\DB)#1 (0) {
}
object(UnQLite\Doc)#2 (0) {
}
*/