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