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


PHP Book::setTitle方法代码示例

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


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

示例1: testFormatALotOfResults

 public function testFormatALotOfResults()
 {
     $nbBooks = 50;
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     Propel::disableInstancePooling();
     $book = new Book();
     for ($i = 0; $i < $nbBooks; $i++) {
         $book->clear();
         $book->setTitle('BookTest' . $i);
         $book->save($con);
     }
     $stmt = $con->query('SELECT * FROM book');
     $formatter = new PropelOnDemandFormatter();
     $formatter->init(new ModelCriteria('bookstore', 'Book'));
     $books = $formatter->format($stmt);
     $this->assertTrue($books instanceof PropelOnDemandCollection, 'PropelOnDemandFormatter::format() returns a PropelOnDemandCollection');
     $this->assertEquals($nbBooks, count($books), 'PropelOnDemandFormatter::format() returns a collection that counts as many rows as the results in the query');
     $i = 0;
     foreach ($books as $book) {
         $this->assertTrue($book instanceof Book, 'PropelOnDemandFormatter::format() returns a collection of Model objects');
         $this->assertEquals('BookTest' . $i, $book->getTitle(), 'PropelOnDemandFormatter::format() returns the model objects matching the query');
         $i++;
     }
     Propel::enableInstancePooling();
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:25,代码来源:PropelOnDemandFormatterTest.php

示例2: handlePUT

function handlePUT(mysqli $conn)
{
    parse_str(file_get_contents("php://input"), $data);
    $book = new Book();
    $book->update($conn, $data['id']);
    $book->setTitle($data['title']);
    $book->setAuthor($data['author']);
    $book->setDesc($data['desc']);
}
开发者ID:RyszardRzepa,项目名称:REST_API,代码行数:9,代码来源:Books.php

示例3: bookInsertion

 function bookInsertion($title, $ISBN, $author)
 {
     $book = new \Book();
     $book->setTitle($title);
     $book->setISBN($ISBN);
     $book->setAuthor($author);
     $book->save();
     return $book;
 }
开发者ID:Big-Shark,项目名称:php-orm-benchmark,代码行数:9,代码来源:TestDefault.php

示例4: testAddingABook

 public function testAddingABook()
 {
     $author = AuthorPeer::retrieveByPK($this->author->getId());
     $c1 = new Book();
     $c1->setTitle("ORM 101");
     $author->addBook($c1);
     $this->assertEquals(3, count($author->getBooks()));
     $this->assertEquals(3, $author->countBooks());
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:9,代码来源:PoisonedCacheBugTest.php

示例5: testUpdate

 function testUpdate()
 {
     $book_name = "Siddhartha";
     $test_book = new Book($book_name);
     $test_book->save();
     $test_book->setTitle("Peace Train");
     $test_book->update();
     $result = Book::getAll();
     $this->assertEquals($test_book, $result[0]);
 }
开发者ID:JordanNavratil,项目名称:Library,代码行数:10,代码来源:BookTest.php

示例6: runBookInsertion

 function runBookInsertion($i)
 {
     $book = new Book();
     $book->setTitle('Hello' . $i);
     $book->setAuthorId($this->authors[array_rand($this->authors)]);
     $book->setISBN('1234');
     $book->setPrice($i);
     $book->save($this->con);
     $this->books[] = $book->getId();
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:10,代码来源:Propel17TestSuite.php

示例7: testSetTitle

 function testSetTitle()
 {
     //Arrange
     $title = "Grapes of Wrath";
     $test_book = new Book($title);
     //Act
     $test_book->setTitle("Cannary Row");
     $result = $test_book->getTitle();
     //Assert
     $this->assertEquals("Cannary Row", $result);
 }
开发者ID:jtorrespdx,项目名称:library_catalog,代码行数:11,代码来源:BookTest.php

示例8: Book

 function test_setTitle()
 {
     //Arrange
     $title = "Uncle Ben's puzzle basement";
     $id = 1;
     $test_book = new Book($title, $id);
     //Act
     $test_book->setTitle("Welcome to Puzzle Heaven");
     $result = $test_book->getTitle();
     //Assert
     $this->assertEquals($result, "Welcome to Puzzle Heaven");
 }
开发者ID:bdspen,项目名称:library_day1,代码行数:12,代码来源:BookTest.php

示例9: Book

 function test_setTitle()
 {
     //Arrange
     $title = "Ben";
     $id = null;
     $test_book = new Book($title, $id);
     //Act
     $test_book->setTitle("Jeremy");
     $result = $test_book->getTitle();
     //Assert
     $this->assertEquals("Jeremy", $result);
 }
开发者ID:jlbethel,项目名称:library-1,代码行数:12,代码来源:BookTest.php

示例10: testSetTitle

 function testSetTitle()
 {
     //Arrange
     $title = "Little Cat";
     $id = 1;
     $test_book = new Book($title, $id);
     //Act
     $test_book->setTitle("Big Cat");
     $result = $test_book->getTitle();
     //Assert
     $this->assertEquals("Big Cat", $result);
 }
开发者ID:bborealis,项目名称:library-1,代码行数:12,代码来源:BookTest.php

示例11: createBooks

 protected function createBooks($nb = 15, $con = null)
 {
     BookQuery::create()->deleteAll($con);
     $books = new PropelObjectCollection();
     $books->setModel('Book');
     for ($i = 0; $i < $nb; $i++) {
         $b = new Book();
         $b->setTitle('Book' . $i);
         $books[] = $b;
     }
     $books->save($con);
 }
开发者ID:keneanung,项目名称:gw2spidy,代码行数:12,代码来源:PropelModelPagerTest.php

示例12: Book

 function test_setTitle()
 {
     //Arrange
     $title = "Adventures on Mars";
     $test_book = new Book($title);
     //Act
     $title2 = "Adventures on Mars 2 Adventure Harder";
     $test_book->setTitle($title2);
     $result = $test_book->getTitle();
     //Assert
     $this->assertEquals($title2, $result);
 }
开发者ID:kevintokheim,项目名称:Liberry,代码行数:12,代码来源:BookTest.php

示例13: setUp

 protected function setUp()
 {
     // reset db contents
     \BookQuery::create()->deleteAll();
     \BookI18nQuery::create()->deleteAll();
     // fill in some dummy data
     // lord of the rings
     $b = new \Book();
     $b->setTitle('Lord of the Rings');
     $b->setTitle('Herr der Ringe', 'de');
     $b->setTitle('Yubiwa Monogatari', 'ja-latn-JP');
     $b->save();
     // harry potter
     $b = new \Book();
     $b->setTitle('Harry Potter and the Philosopher\'s Stone');
     $b->setTitle('Harry Potter und der Stein der Weisen', 'de');
     $b->setTitle('Harī Pottā to kenja no ishi', 'ja-latn-JP');
     $b->save();
     $b = new \Book();
     $b->setTitle('Harry Potter and the Prisoner of Azkaban');
     $b->setTitle('Harry Potter und der Gefangene von Askaban', 'de');
     $b->setTitle('Harī Pottā to Azukaban no shūjin', 'ja-latn-JP');
     $b->save();
 }
开发者ID:gossi,项目名称:propel-l10n-behavior,代码行数:24,代码来源:BookQueryTest.php

示例14: runBookInsertion

 function runBookInsertion($i)
 {
     $rand = array_rand($this->authors);
     $book = new Book();
     $book->setTitle('Hello' . $i);
     $book->setAuthor($this->authors[$rand]);
     $book->setISBN('1234');
     $book->setPrice($i);
     $this->session->persist($book);
     $this->session->persist($this->authors[$rand]);
     $this->books[] = $book;
     $this->i++;
     if ($this->i >= 500) {
         $this->commit();
         $this->beginTransaction();
     }
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:17,代码来源:PropelDMTestSuite.php

示例15: setUp

 protected function setUp()
 {
     parent::setUp();
     BookstoreDataPopulator::populate();
     $cr = new Criteria();
     $cr->add(AuthorPeer::LAST_NAME, "Rowling");
     $cr->add(AuthorPeer::FIRST_NAME, "J.K.");
     $rowling = AuthorPeer::doSelectOne($cr);
     $this->authorId = $rowling->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Philosopher's Stone");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Chamber of Secrets");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Prisoner of Azkaban");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Goblet of Fire");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Half-Blood Prince");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
     $book = new Book();
     $book->setTitle("Harry Potter and the Deathly Hallows");
     $book->setISBN("1234");
     $book->setAuthor($rowling);
     $book->save();
     $this->books[] = $book->getId();
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:46,代码来源:PropelPagerTest.php


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