Beispiel #1
0
 function db()
 {
     $_this =& Mongo::getInstance();
     if ($_this->mongo == null or $_this->db == null) {
         return null;
     }
     return $_this->mongo->{$_this->db};
 }
Beispiel #2
0
 function __construct()
 {
     $model = str_replace('models\\', '', strtolower(get_class($this)));
     $db = Mongo::db();
     if ($db == null) {
         return false;
     }
     $this->__collection = $db->{$model};
 }
Beispiel #3
0
<?php

namespace app;

use lib\Configure;
Configure::getInstance();
Configure::write('version', '0.1.3');
Configure::write('database', array('connect' => 'mongodb://localhost:27017', 'database' => 'timesheet'));
Configure::write('template_engine', 'dwoo');
use lib\db\Mongo;
Mongo::getInstance();
Mongo::init(Configure::read('database'));