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


PHP Author::first方法代码示例

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


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

示例1: test_regular_models_not_cached

 public function test_regular_models_not_cached()
 {
     $method = $this->set_method_public('Author', 'cache_key');
     $author = Author::first();
     $cache_key = $method->invokeArgs($author, array());
     $this->assertFalse(Cache::$adapter->read($cache_key));
 }
开发者ID:nehulyadav,项目名称:php-activerecord,代码行数:7,代码来源:CacheModelTest.php

示例2: test_caches_column_meta_data

 public function test_caches_column_meta_data()
 {
     Author::first();
     $table_name = Author::table()->get_fully_qualified_table_name(!$this->conn instanceof ActiveRecord\PgsqlAdapter);
     $value = Cache::$adapter->read("get_meta_data-{$table_name}");
     $this->assert_true(is_array($value));
 }
开发者ID:karthik93r,项目名称:HuMvc,代码行数:7,代码来源:ActiveRecordCacheTest.php

示例3: testCachesColumnMetaData

 public function testCachesColumnMetaData()
 {
     Author::first();
     $tableName = Author::table()->getFullyQualifiedTableName(!$this->conn instanceof ActiveRecord\PgsqlAdapter);
     $value = Cache::$adapter->read("get_meta_data-{$tableName}");
     $this->assertTrue(is_array($value));
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:7,代码来源:ActiveRecordCacheTest.php

示例4: test_datefield_gets_converted_to_ar_datetime

 public function test_datefield_gets_converted_to_ar_datetime()
 {
     //make sure first author has a date
     $author = Author::first();
     $author->some_date = new DateTime();
     $author->save();
     $author = Author::first();
     $this->assert_is_a("ActiveRecord\\DateTime", $author->some_date);
 }
开发者ID:Arunkumarcs,项目名称:Themis-Reinitialize,代码行数:9,代码来源:DateFormatTest.php

示例5: test_has_many_build_association

 public function test_has_many_build_association()
 {
     $author = Author::first();
     $this->assert_equals($author->id, $author->build_books()->author_id);
     $this->assert_equals($author->id, $author->build_book()->author_id);
 }
开发者ID:Arunkumarcs,项目名称:Themis-Reinitialize,代码行数:6,代码来源:RelationshipTest.php

示例6: test_is_dirty

 public function test_is_dirty()
 {
     $author = Author::first();
     $this->assert_equals(false, $author->is_dirty());
     $author->name = 'coco';
     $this->assert_equals(true, $author->is_dirty());
 }
开发者ID:J1Duran,项目名称:ph-web,代码行数:7,代码来源:ActiveRecordWriteTest.php

示例7: testHaving

 public function testHaving()
 {
     if ($this->conn instanceof ActiveRecord\OciAdapter) {
         $author = Author::first(array('select' => 'to_char(created_at,\'YYYY-MM-DD\') as created_at', 'group' => 'to_char(created_at,\'YYYY-MM-DD\')', 'having' => "to_char(created_at,'YYYY-MM-DD') > '2009-01-01'"));
         $this->assertSqlHas("GROUP BY to_char(created_at,'YYYY-MM-DD') HAVING to_char(created_at,'YYYY-MM-DD') > '2009-01-01'", Author::table()->lastSql);
     } else {
         $author = Author::first(array('select' => 'date(created_at) as created_at', 'group' => 'date(created_at)', 'having' => "date(created_at) > '2009-01-01'"));
         $this->assertSqlHas("GROUP BY date(created_at) HAVING date(created_at) > '2009-01-01'", Author::table()->lastSql);
     }
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:10,代码来源:ActiveRecordFindTest.php

示例8: test_having

 public function test_having()
 {
     $author = Author::first(array('group' => "date(created_at)", 'having' => "created_at > '2009-01-01'"));
     $this->assert_true(strpos(Author::table()->last_sql, "GROUP BY date(created_at) HAVING created_at > '2009-01-01'") !== false);
 }
开发者ID:scorplev,项目名称:php-activerecord,代码行数:5,代码来源:ActiveRecordFindTest.php

示例9: test_only_method

 public function test_only_method()
 {
     $this->assert_contains('<sharks>lasers</sharks>', Author::first()->to_xml(array('only_method' => 'return_something')));
 }
开发者ID:Arunkumarcs,项目名称:Themis-Reinitialize,代码行数:4,代码来源:SerializationTest.php

示例10: test_undefined_instance_method

 /**
  * @expectedException ActiveRecord\ActiveRecordException
  */
 public function test_undefined_instance_method()
 {
     Author::first()->find_by_name('sdf');
 }
开发者ID:sebcode,项目名称:php-activerecord,代码行数:7,代码来源:ActiveRecordTest.php

示例11: testOnlyMethod

 public function testOnlyMethod()
 {
     $this->assertContains('<sharks>lasers</sharks>', Author::first()->toXml(array('onlyMethod' => 'returnSomething')));
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:4,代码来源:SerializationTest.php

示例12: testHasManyBuildAssociation

 public function testHasManyBuildAssociation()
 {
     $author = Author::first();
     $this->assertEquals($author->id, $author->buildBooks()->author_id);
     $this->assertEquals($author->id, $author->buildBook()->author_id);
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:6,代码来源:RelationshipTest.php

示例13: test_has_one_can_be_self_referential

 public function test_has_one_can_be_self_referential()
 {
     Author::$has_one[1] = array('parent_author', 'class_name' => 'Author', 'foreign_key' => 'parent_author_id');
     $author = Author::first();
     $this->assert_equals(1, $author->id);
     $this->assert_equals(3, $author->parent_author->id);
 }
开发者ID:scorplev,项目名称:php-activerecord,代码行数:7,代码来源:RelationshipTest.php

示例14: testUndefinedInstanceMethod

 /**
  * @expectedException ActiveRecord\ActiveRecordException
  */
 public function testUndefinedInstanceMethod()
 {
     Author::first()->findByName('sdf');
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:7,代码来源:ActiveRecordTest.php


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