当前位置: 首页>>代码示例>>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;未经允许,请勿转载。