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


PHP Author::table方法代码示例

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


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

示例1: 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

示例2: 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

示例3: test_delete_with_no_primary_key_defined

 /**
  * @expectedException ActiveRecord\ActiveRecordException
  */
 public function test_delete_with_no_primary_key_defined()
 {
     Author::table()->pk = array();
     $author = author::first();
     $author->delete();
 }
开发者ID:J1Duran,项目名称:ph-web,代码行数:9,代码来源:ActiveRecordWriteTest.php

示例4: testFindByPkShouldNotUseLimit

 public function testFindByPkShouldNotUseLimit()
 {
     Author::find(1);
     $this->assertSqlHas('SELECT * FROM authors WHERE author_id=?', Author::table()->lastSql);
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:5,代码来源:ActiveRecordFindTest.php

示例5: 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

示例6: test_find_by_pk_should_not_use_limit

 public function test_find_by_pk_should_not_use_limit()
 {
     Author::find(1);
     $this->assert_sql_has('SELECT * FROM authors WHERE author_id=?', Author::table()->last_sql);
 }
开发者ID:J1Duran,项目名称:ph-web,代码行数:5,代码来源:ActiveRecordFindTest.php

示例7: test_default_expire

 public function test_default_expire()
 {
     $this->assert_equals(30, Author::table()->cache_model_expire);
 }
开发者ID:nehulyadav,项目名称:php-activerecord,代码行数:4,代码来源:CacheModelTest.php

示例8: test_update_all_with_limit_and_order

 public function test_update_all_with_limit_and_order()
 {
     if (!$this->conn->accepts_limit_and_order_for_update_and_delete()) {
         $this->mark_test_skipped('Only MySQL & Sqlite accept limit/order with UPDATE clause');
     }
     $num_affected = Author::update_all(array('set' => 'parent_author_id = 2', 'limit' => 1, 'order' => 'name asc'));
     $this->assert_equals(1, $num_affected);
     $this->assert_true(strpos(Author::table()->last_sql, 'ORDER BY name asc LIMIT 1') !== false);
 }
开发者ID:jhonleandres,项目名称:batata,代码行数:9,代码来源:ActiveRecordWriteTest.php

示例9: testUpdateAllWithLimitAndOrder

 public function testUpdateAllWithLimitAndOrder()
 {
     if (!$this->conn->acceptsLimitAndOrderForUpdateAndDelete()) {
         $this->markTestSkipped('Only MySQL & Sqlite accept limit/order with UPDATE clause');
     }
     $numAffected = Author::updateAll(array('set' => 'parent_author_id = 2', 'limit' => 1, 'order' => 'name asc'));
     $this->assertEquals(1, $numAffected);
     $this->assertTrue(strpos(Author::table()->lastSql, 'ORDER BY name asc LIMIT 1') !== false);
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:9,代码来源:ActiveRecordWriteTest.php

示例10: testWithOptionArray

 /**
  * @covers ::with()
  */
 public function testWithOptionArray()
 {
     $b = new SelectBuilder();
     $b->root('Article');
     $b->with(['blog', 'author'])->select(['*']);
     $components = $b->build();
     $jc = array(new JoinClause('articles', '_'), (new JoinClause('blogs', 'blog', JoinClause::LEFT))->on('_', 'blog_id', 'blog', 'id'), (new JoinClause('authors', 'author', JoinClause::LEFT))->on('_', 'author_id', 'author', 'id'));
     $columns = array('_' => ['columns' => Article::table()->getColumns(), 'resAlias' => ''], 'blog' => ['columns' => Blog::table()->getColumns(), 'resAlias' => 'blog'], 'author' => ['columns' => Author::table()->getColumns(), 'resAlias' => 'author']);
     $this->assertEquals($jc, $components['from']);
     $this->assertEquals($columns, $components['columns']);
 }
开发者ID:lucasnpinheiro,项目名称:SimpleAR,代码行数:14,代码来源:SelectBuilderTest.php

示例11: testAddInvolvedTable

 public function testAddInvolvedTable()
 {
     $b = new WhereBuilder();
     $b->setRootModel('Blog');
     $b->addInvolvedTable('articles.author');
     $this->assertEquals('Article', $b->getInvolvedModel('articles'));
     $this->assertEquals(Article::table(), $b->getInvolvedTable('articles'));
     $jc = (new JoinClause('articles', 'articles'))->on('_', 'id', 'articles', 'blog_id');
     $this->assertEquals($jc, $b->getJoinClause('articles'));
     $this->assertEquals('Author', $b->getInvolvedModel('articles.author'));
     $this->assertEquals(Author::table(), $b->getInvolvedTable('articles.author'));
     $jc = (new JoinClause('authors', 'articles.author'))->on('articles', 'author_id', 'articles.author', 'id');
     $this->assertEquals($jc, $b->getJoinClause('articles.author'));
 }
开发者ID:lucasnpinheiro,项目名称:SimpleAR,代码行数:14,代码来源:WhereBuilderTest.php


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