本文整理汇总了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;
}