當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。