Closed shraddhabanerjee closed 7 years ago
Looks like you're missing a use statement. Provided that the legacy MongoDB PHP extension is installed, you can either try ` <?php
namespace App\Controller;
use MongoDate;
$start_date = new MongoDate\BSON\UTCDateTime(strtotime($start)); ` or conversely, you can use the fully qualified class name to access the class reference without the use statement:
// Notice the \ in front of MongoDate! $start_date = new \MongoDate\BSON\UTCDateTime(strtotime($start));
Good luck!
Hi,
I have cakePHP 3, MongoDB 3, PHP 5.6. In my code I have $start_date = new MongoDate\BSON\UTCDateTime(strtotime($start));
But it gives me the following error: Error: Class 'App\Controller\MongoDate' not found File /var/www/caketest/src/Controller/ReportsController.php Line: 53
Can you please tell whether I need to include or use any files in the controller or anything is missing.. Thanks in advance :)