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