コード例 #1
0
 public static function setUpBeforeClass()
 {
     $connection = new \MongoClient(self::$_server);
     self::$_dbConnection1 = $connection->{self::$_database1};
     self::$_dbConnection2 = $connection->{self::$_database2};
     \Mawelous\Yamop\Mapper::setDatabase(array('first' => self::$_dbConnection1, 'second' => self::$_dbConnection2));
 }
コード例 #2
0
ファイル: Mapper.php プロジェクト: mawelous/yamop-laravel
 /**
  * (non-PHPdoc)
  * @see \Mawelous\Yamop\Mapper::getPaginator()
  */
 public function getPaginator($perPage = 10, $page = null, $options = null)
 {
     if ($page == null) {
         $pageParamName = $options ?: 'page';
         $page = (int) \Input::get($pageParamName, 1);
     }
     return parent::getPaginator($perPage, $page, $options);
 }
コード例 #3
0
 public static function setUpBeforeClass()
 {
     $connection = new \MongoClient(self::$_server);
     self::$_dbConnection = $connection->{self::$_database};
     \Mawelous\Yamop\Mapper::setDatabase(self::$_dbConnection);
 }
コード例 #4
0
ファイル: MapperTest.php プロジェクト: taichiatshanghai/yamop
 public function testCallNativeInsertWithoutW()
 {
     $mapper = new Mapper('\\Model\\Simple');
     $result = $mapper->insert($this->_getSimpleData(), array('w' => 0));
     $this->assertTrue($result);
     $dbData = self::$_dbConnection->simple->find();
     $this->assertInstanceOf('MongoCursor', $dbData);
     $this->assertCount(1, $dbData);
 }
コード例 #5
0
function mongo_connect($host, $dbName)
{
    $connection = new \MongoClient($host);
    \Mawelous\Yamop\Mapper::setDatabase($connection->{$dbName});
}