本文整理匯總了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();
}
示例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;
}
示例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());
}
示例4: addBook
public function addBook(Book $object)
{
$object->setAuthorId($this->getAuthorId());
$object->setAuthor_Object($this);
$this->getBook_Collection()->add($object);
return $object;
}