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)); }
/** * (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); }
public static function setUpBeforeClass() { $connection = new \MongoClient(self::$_server); self::$_dbConnection = $connection->{self::$_database}; \Mawelous\Yamop\Mapper::setDatabase(self::$_dbConnection); }
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); }
function mongo_connect($host, $dbName) { $connection = new \MongoClient($host); \Mawelous\Yamop\Mapper::setDatabase($connection->{$dbName}); }