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


PHP Book::first方法代码示例

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


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

示例1: crudDelete

 public function crudDelete()
 {
     # Get a book to delete
     $book = Book::first();
     # Delete the book
     $book->delete();
     echo "This book has been deleted";
 }
开发者ID:rebekahheacock,项目名称:dwa15-archive,代码行数:8,代码来源:DemoController.php

示例2: test_dirty_attributes_with_mass_assignment

 public function test_dirty_attributes_with_mass_assignment()
 {
     $book = Book::first();
     $book->set_attributes(array('name' => 'rivers cuomo'));
     $this->assert_equals(array('name'), array_keys($book->dirty_attributes()));
 }
开发者ID:J1Duran,项目名称:ph-web,代码行数:6,代码来源:ActiveRecordWriteTest.php

示例3: test_getter

 public function test_getter()
 {
     $book = Book::first();
     $this->assert_equals(strtoupper($book->name), $book->upper_name);
 }
开发者ID:sebcode,项目名称:php-activerecord,代码行数:5,代码来源:ActiveRecordTest.php

示例4: testDirtyAttributesWithMassAssignment

 public function testDirtyAttributesWithMassAssignment()
 {
     $book = Book::first();
     $book->setAttributes(array('name' => 'rivers cuomo'));
     $this->assertEquals(array('name'), array_keys($book->dirtyAttributes()));
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:6,代码来源:ActiveRecordWriteTest.php

示例5: dirname

<?php

require_once dirname(__FILE__) . '/../../ActiveRecord.php';
// assumes a table named "books" with a pk named "id"
// see simple.sql
class Book extends ActiveRecord\Model
{
}
// initialize ActiveRecord
// change the connection settings to whatever is appropriate for your mysql server
ActiveRecord\Config::initialize(function ($cfg) {
    $cfg->set_model_directory('.');
    $cfg->set_connections(array('development' => 'mysql://test:test@127.0.0.1/test'));
});
print_r(Book::first()->attributes());
开发者ID:aslijiasheng,项目名称:jacksonslim,代码行数:15,代码来源:simple.php

示例6: test_readonly_only_halt_on_write_method

 public function test_readonly_only_halt_on_write_method()
 {
     $book = Book::first(array('readonly' => true));
     $this->assert_true($book->is_readonly());
     try {
         $book->save();
         $this - fail('expected exception ActiveRecord\\ReadonlyException');
     } catch (ActiveRecord\ReadonlyException $e) {
     }
     $book->name = 'some new name';
     $this->assert_equals($book->name, 'some new name');
 }
开发者ID:scorplev,项目名称:php-activerecord,代码行数:12,代码来源:ActiveRecordTest.php


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