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


PHP Book::setISBN方法代碼示例

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


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

示例1: testSavedObjectsWithCriteria

 public function testSavedObjectsWithCriteria()
 {
     $a = new Author();
     $a->setFirstName("Douglas");
     $a->setLastName("Adams");
     $b1 = new Book();
     $b1->setTitle("The Hitchhikers Guide To The Galaxy");
     $b1->setISBN('123');
     $a->addBook($b1);
     $b2 = new Book();
     $b2->setTitle("The Restaurant At The End Of The Universe");
     $b2->setISBN('123');
     $a->addBook($b2);
     $c = new Criteria();
     $c->add(BookPeer::TITLE, "%Hitchhiker%", Criteria::LIKE);
     /* This is the same as testNewObjectsWithCriteria EXCEPT we're now going
     		to save(). Now the $author and related objects are no longer new
     		and thus the criteria will be applied in the database.
     
     		Apart from that the fix is for sure not trivial, observable behaviour
     		of the $author should not depend on having called save() or not... */
     $booksBeforeSave = $a->getBooks($c);
     $a->save();
     $booksAfterSave = $a->getBooks($c);
     // As of revision 851, this passes...
     $this->assertEquals(1, count($booksAfterSave));
     foreach ($booksAfterSave as $book) {
         $this->assertEquals($b1, $book);
     }
     /* ... but this would fail. Commented out because it's covered
     		by testNewObjectsWithCriteria(). */
     //$this->assertEquals($booksBeforeSave, $booksAfterSave);
 }
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:33,代碼來源:Ticket520Test.php

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

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

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

示例5: testSavedObjectCreatesDifferentHashForIdenticalObjects

 /**
  * Primary key should differ
  */
 public function testSavedObjectCreatesDifferentHashForIdenticalObjects()
 {
     $book1 = new Book();
     $book1->setTitle('Foo5');
     $book1->setISBN('1234');
     $author1 = new Author();
     $author1->setFirstName('JAne');
     $author1->setLastName('JAne');
     $author1->addBook($book1);
     $author1->save();
     $author2 = new Author();
     $author2->setFirstName('JAne');
     $author2->setLastName('JAne');
     $author2->addBook($book1);
     $author2->save();
     $this->assertNotEquals($author1->hashCode(), $author2->hashCode());
 }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:20,代碼來源:BaseObjectHashCodeTest.php

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

示例7: testSerializeObjectWithCollections

 public function testSerializeObjectWithCollections()
 {
     $book1 = new Book();
     $book1->setTitle('Foo5');
     $book1->setISBN('1234');
     $book2 = new Book();
     $book2->setTitle('Foo6');
     $book2->setISBN('1234');
     $author = new Author();
     $author->setFirstName('JAne');
     $author->addBook($book1);
     $author->addBook($book2);
     $author->save();
     $a = clone $author;
     $sa = serialize($a);
     $author->clearAllReferences();
     $this->assertEquals($author, unserialize($sa));
 }
開發者ID:kcornejo,項目名稱:estadistica,代碼行數:18,代碼來源:BaseObjectSerializeTest.php

示例8: testCloneContainingObjects

 public function testCloneContainingObjects()
 {
     $a = new Author();
     $b = new Book();
     $b->setAuthor($a);
     $b->setISBN('ISBN1');
     $b1 = new Book();
     $b1->setPrice(5.55);
     $col = new PropelCollection(array($b, $b1));
     $clone = clone $col;
     $orgCount = $col->getIterator()->count();
     $cloneCount = $clone->getIterator()->count();
     $this->assertEquals($orgCount, $cloneCount, 'cloned collections have the same size');
     $this->assertEquals($b, $clone[0], 'cloned objects are equal');
     $this->assertEquals($b1, $clone[1], 'cloned objects are equal');
     $this->assertNotSame($b, $clone[0], 'cloned objects are copies, not identical');
     $this->assertNotSame($b1, $clone[1], 'cloned objects are copies, not identical');
 }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:18,代碼來源:PropelCollectionTest.php

示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     $publisher = new Publisher();
     $publisher->setId(1234);
     $publisher->setName('Penguin');
     $author = new Author();
     $author->setId(5678);
     $author->setFirstName('George');
     $author->setLastName('Byron');
     $book = new Book();
     $book->setId(9012);
     $book->setTitle('Don Juan');
     $book->setISBN('0140422161');
     $book->setPrice(12.99);
     $book->setAuthor($author);
     $book->setPublisher($publisher);
     $this->book = $book;
 }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:19,代碼來源:BaseObjectConvertTest.php

示例10: testUtf8

 public function testUtf8()
 {
     $db = Propel::getDB(BookPeer::DATABASE_NAME);
     $title = "Смерть на брудершафт. Младенец и черт";
     //        1234567890123456789012345678901234567
     //                 1         2         3
     $a = new Author();
     $a->setFirstName("Б.");
     $a->setLastName("АКУНИН");
     $p = new Publisher();
     $p->setName("Детектив российский, остросюжетная проза");
     $b = new Book();
     $b->setTitle($title);
     $b->setISBN("B-59246");
     $b->setAuthor($a);
     $b->setPublisher($p);
     $b->save();
     $b->reload();
     $this->assertEquals(37, iconv_strlen($b->getTitle(), 'utf-8'), "Expected 37 characters (not bytes) in title.");
     $this->assertTrue(strlen($b->getTitle()) > iconv_strlen($b->getTitle(), 'utf-8'), "Expected more bytes than characters in title.");
 }
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:21,代碼來源:CharacterEncodingTest.php

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

示例12: testMultiColFk

 /**
  * Testing foreign keys with multiple referrer columns.
  * @link       http://propel.phpdb.org/trac/ticket/606
  */
 public function testMultiColFk()
 {
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     ReaderFavoritePeer::doDeleteAll();
     $b1 = new Book();
     $b1->setTitle("Book1");
     $b1->setISBN("ISBN-1");
     $b1->save();
     $r1 = new BookReader();
     $r1->setName("Me");
     $r1->save();
     $bo1 = new BookOpinion();
     $bo1->setBookId($b1->getId());
     $bo1->setReaderId($r1->getId());
     $bo1->setRating(9);
     $bo1->setRecommendToFriend(true);
     $bo1->save();
     $rf1 = new ReaderFavorite();
     $rf1->setReaderId($r1->getId());
     $rf1->setBookId($b1->getId());
     $rf1->save();
     $c = new Criteria(ReaderFavoritePeer::DATABASE_NAME);
     $c->add(ReaderFavoritePeer::BOOK_ID, $b1->getId());
     $c->add(ReaderFavoritePeer::READER_ID, $r1->getId());
     $results = ReaderFavoritePeer::doSelectJoinBookOpinion($c);
     $this->assertEquals(1, count($results), "Expected 1 result");
 }
開發者ID:RafalFilipek,項目名稱:Propel2,代碼行數:31,代碼來源:GeneratedPeerDoSelectTest.php

示例13: testToKeyValue

 public function testToKeyValue()
 {
     $author = new Author();
     $author->setId(5678);
     $author->setFirstName('George');
     $author->setLastName('Byron');
     $book = new Book();
     $book->setId(9012);
     $book->setTitle('Don Juan');
     $book->setISBN('0140422161');
     $book->setPrice(12.99);
     $book->setAuthor($author);
     $coll = new PropelObjectCollection();
     $coll->setModel('Book');
     $coll->append($book);
     $this->assertCount(1, $coll);
     // This will call $book->getId()
     $this->assertEquals(array(9012 => 'Don Juan'), $coll->toKeyValue('Id', 'Title'));
     // This will call: $book->getAuthor()->getBooks()->getFirst()->getId()
     $this->assertEquals(array(9012 => 'Don Juan'), $coll->toKeyValue(array('Author', 'Books', 'First', 'Id'), 'Title'));
 }
開發者ID:renepardon,項目名稱:Propel,代碼行數:21,代碼來源:PropelObjectCollectionTest.php

示例14: testDoValidate_CustomValidator

 public function testDoValidate_CustomValidator()
 {
     $book = new Book();
     $book->setTitle("testDoValidate_CustomValidator");
     // (valid)
     $book->setISBN("Foo.Bar.Baz");
     // (invalid)
     $res = $book->validate();
     $this->assertFalse($res, "Expected validation to fail.");
     $failures = $book->getValidationFailures();
     $this->assertEquals(1, count($failures), "Expected 1 column to fail validation.");
     $this->assertEquals(array(BookPeer::ISBN), array_keys($failures), "Expected EMAIL to fail validation.");
     $validator = $failures[BookPeer::ISBN]->getValidator();
     $this->assertType('ISBNValidator', $validator, "Expected validator that failed to be ISBNValidator");
 }
開發者ID:nhemsley,項目名稱:propel,代碼行數:15,代碼來源:ValidatorTest.php

示例15: testDoCountJoin

 /**
  * Test doCountJoin*() methods.
  */
 public function testDoCountJoin()
 {
     BookPeer::doDeleteAll();
     for ($i = 0; $i < 25; $i++) {
         $b = new Book();
         $b->setTitle("Book {$i}");
         $b->setISBN("ISBN {$i}");
         $b->save();
     }
     $c = new Criteria();
     $totalCount = BookPeer::doCount($c);
     $this->assertEquals($totalCount, BookPeer::doCountJoinAuthor($c));
     $this->assertEquals($totalCount, BookPeer::doCountJoinPublisher($c));
 }
開發者ID:ketheriel,項目名稱:ETVA,代碼行數:17,代碼來源:GeneratedPeerDoDeleteTest.php


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