コード例 #1
0
ファイル: test.php プロジェクト: sm115/SYFramework
 public static function _i()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
コード例 #2
0
 function test_group()
 {
     $res = MTest::query()->fetch(2);
     foreach ($res as $row) {
         $row->category = 'one';
         $row->put();
     }
     $res = MTest::query()->fetch(2, 2);
     foreach ($res as $row) {
         $row->category = 'two';
         $row->put();
     }
     $res = MTest::query()->group(array('category' => 1), array('items' => array()), 'function (obj, prev) { prev.items.push (obj.foo); }');
     $this->assertEquals(4, $res['count']);
     $this->assertEquals(2, $res['keys']);
     $this->assertEquals(1, $res['ok']);
     $one = $res['retval'][0];
     $this->assertEquals(2, count($one['items']));
     $two = $res['retval'][1];
     $this->assertEquals(2, count($two['items']));
 }