當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Book::setAuthorId方法代碼示例

本文整理匯總了PHP中Book::setAuthorId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Book::setAuthorId方法的具體用法?PHP Book::setAuthorId怎麽用?PHP Book::setAuthorId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Book的用法示例。


在下文中一共展示了Book::setAuthorId方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

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

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     $book1 = new Book();
     $book1->setId(9012);
     $book1->setTitle('Don Juan');
     $book1->setISBN('0140422161');
     $book1->setPrice(12.99);
     $book1->setAuthorId(5678);
     $book1->setPublisherId(1234);
     $book1->resetModified();
     $book2 = new Book();
     $book2->setId(58);
     $book2->setTitle('Harry Potter and the Order of the Phoenix');
     $book2->setISBN('043935806X');
     $book2->setPrice(10.99);
     $book2->resetModified();
     $this->coll = new PropelObjectCollection();
     $this->coll->setModel('Book');
     $this->coll[] = $book1;
     $this->coll[] = $book2;
 }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:22,代碼來源:PropelCollectionConvertTest.php

示例3: testLoadObject

 public function testLoadObject()
 {
     $newAuthor = new Author();
     $newAuthor->setName('James Joyce');
     $newAuthor->setCreationDatetime(date('Y-m-d H:i:s'));
     $newAuthor->save();
     $newBook = new Book();
     $newBook->setTitle('Ulysses');
     $newBook->setAuthorId($newAuthor->getAuthorId());
     $newBook->setIntroduction('1264 pages of bs by one of the masters.');
     $newBook->setCreationDatetime(date('Y-m-d H:i:s'));
     $newBook->save();
     $sameBook = Book::constructByKey($newBook->getBookId());
     // this one fails; see ticket #27, http://trac.coughphp.com/ticket/27
     //$this->assertIdentical($newBook->getBookId(), $sameBook->getBookId());
     $this->assertEqual($newBook->getBookId(), $sameBook->getBookId());
     $this->assertIdentical($newBook->getTitle(), $sameBook->getTitle());
     // again, this is broke; see ticket #27
     //$this->assertIdentical($newBook->getAuthorId(), $sameBook->getAuthorId());
     $this->assertEqual($newBook->getAuthorId(), $sameBook->getAuthorId());
     $this->assertIdentical($newBook->getIntroduction(), $sameBook->getIntroduction());
     $this->assertIdentical($newBook->getCreationDatetime(), $sameBook->getCreationDatetime());
 }
開發者ID:jmhobbs,項目名稱:MkLst,代碼行數:23,代碼來源:TestCoughObject.class.php

示例4: addBook

 public function addBook(Book $object)
 {
     $object->setAuthorId($this->getAuthorId());
     $object->setAuthor_Object($this);
     $this->getBook_Collection()->add($object);
     return $object;
 }
開發者ID:jmhobbs,項目名稱:MkLst,代碼行數:7,代碼來源:Author_Generated.class.php


注:本文中的Book::setAuthorId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。