当前位置: 首页>>代码示例>>PHP>>正文


PHP UserModel::objects方法代码示例

本文整理汇总了PHP中UserModel::objects方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::objects方法的具体用法?PHP UserModel::objects怎么用?PHP UserModel::objects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserModel的用法示例。


在下文中一共展示了UserModel::objects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCustomeFields

 public function testCustomeFields()
 {
     $q = UserModel::objects()->limit(5)->values(['user_id', 'username']);
     foreach ($q as $obj) {
         $this->assertCount(2, $obj);
     }
 }
开发者ID:buldezir,项目名称:dja_orm,代码行数:7,代码来源:ValuesQuerySetTest.php

示例2: testFilterIn3

 public function testFilterIn3()
 {
     $q1 = UserModel::objects()->filter(['user_id__in' => [1, 2, 3, 4, 5]])->valuesList('pk', false);
     $q2 = CustomerOrderModel::objects()->filter(['user__in' => $q1]);
     $obj = $q2->current();
     $this->assertInstanceOf('\\Dja\\Db\\Model\\Model', $obj);
     $this->assertContains($obj->user_id, [1, 2, 3, 4, 5]);
 }
开发者ID:buldezir,项目名称:dja_orm,代码行数:8,代码来源:LookupTest.php

示例3: testRefresh

 public function testRefresh()
 {
     $obj = UserModel::objects()->get(1);
     $initial = $obj->username;
     $obj->username = 'testtest';
     $obj->refresh();
     $this->assertEquals($initial, $obj->username);
 }
开发者ID:buldezir,项目名称:dja_orm,代码行数:8,代码来源:ModelTest.php

示例4: testGetOrCreate

 public function testGetOrCreate()
 {
     $obj = UserModel::objects()->getOrCreate(['user_id' => 1]);
     $this->assertInstanceOf('\\UserModel', $obj);
     $this->assertFalse($obj->isNewRecord());
     $obj = UserModel::objects()->getOrCreate(['user_id' => 99999]);
     $this->assertInstanceOf('\\UserModel', $obj);
     $this->assertTrue($obj->isNewRecord());
 }
开发者ID:buldezir,项目名称:dja_orm,代码行数:9,代码来源:ManagerTest.php

示例5: testSelectingCached

 public function testSelectingCached()
 {
     $countQ1 = count(SqlLog::$log->queries);
     $q = UserModel::objects()->raw('SELECT * FROM :t LIMIT 5');
     foreach ($q->cached() as $obj) {
         $this->assertInstanceOf('\\Dja\\Db\\Model\\Model', $obj);
     }
     foreach ($q->cached() as $obj) {
         $this->assertInstanceOf('\\Dja\\Db\\Model\\Model', $obj);
     }
     $countQ2 = count(SqlLog::$log->queries);
     $this->assertEquals(1, $countQ2 - $countQ1);
 }
开发者ID:buldezir,项目名称:dja_orm,代码行数:13,代码来源:RawQuerySetTest.php

示例6: testUsing

 public function testUsing()
 {
     $conn = Dja\Db\Model\Metadata::getDefaultDbConnection();
     $q = UserModel::objects()->limit(5)->using($conn);
     $q->count();
 }
开发者ID:buldezir,项目名称:dja_orm,代码行数:6,代码来源:QuerySetTest.php

示例7: testBase

 public function testBase()
 {
     $q = UserModel::objects()->filter(['pk__lt' => 10])->limit(1);
     $obj = $q->current();
     $this->assertEquals($obj->slug, slugify($obj->fullname));
 }
开发者ID:buldezir,项目名称:dja_orm,代码行数:6,代码来源:SlugTest.php


注:本文中的UserModel::objects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。