当前位置: 首页>>代码示例>>PHP>>正文


PHP Book::setISBN方法代码示例

本文整理汇总了PHP中Propel\Tests\Bookstore\Book::setISBN方法的典型用法代码示例。如果您正苦于以下问题:PHP Book::setISBN方法的具体用法?PHP Book::setISBN怎么用?PHP Book::setISBN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Propel\Tests\Bookstore\Book的用法示例。


在下文中一共展示了Book::setISBN方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createBooks

 protected function createBooks($nb = 15, $con = null)
 {
     BookQuery::create()->deleteAll($con);
     $books = new ObjectCollection();
     $books->setModel('\\Propel\\Tests\\Bookstore\\Book');
     for ($i = 0; $i < $nb; $i++) {
         $b = new Book();
         $b->setTitle('Book' . $i);
         $b->setISBN('FA404-' . $i);
         $books[] = $b;
     }
     $books->save($con);
 }
开发者ID:robin850,项目名称:Propel2,代码行数:13,代码来源:PropelModelPagerTest.php

示例2: 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:RafalFilipek,项目名称:Propel2,代码行数:46,代码来源:PropelPagerTest.php

示例3: 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:norfil,项目名称:Propel2,代码行数:18,代码来源:BaseObjectSerializeTest.php

示例4: 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:disider,项目名称:Propel2,代码行数:19,代码来源:ActiveRecordConvertTest.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     $a = new Author();
     $a->setFirstName("Douglas");
     $a->setLastName("Adams");
     $b1 = new Book();
     $b1->setTitle("The Hitchhikers Guide To The Galaxy");
     $b1->setISBN('01234');
     $a->addBook($b1);
     $b2 = new Book();
     $b2->setTitle("The Restaurant At The End Of The Universe");
     $b2->setISBN('5678');
     $a->addBook($b2);
     $a->save();
     $this->author = $a;
     $this->books = array($b1, $b2);
     Propel::enableInstancePooling();
     // Clear author instance pool so the object would be fetched from the database
     AuthorTableMap::clearInstancePool();
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:21,代码来源:PoisonedCacheBugTest.php

示例6: 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 ObjectCollection();
     $this->coll->setModel('\\Propel\\Tests\\Bookstore\\Book');
     $this->coll[] = $book1;
     $this->coll[] = $book2;
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:22,代码来源:CollectionConvertTest.php

示例7: testUtf8

 public function testUtf8()
 {
     $this->markTestSkipped('Skipped because of weird behavior on some platforms');
     $db = Propel::getServiceContainer()->getAdapter(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:norfil,项目名称:Propel2,代码行数:22,代码来源:CharacterEncodingTest.php

示例8: testGroupByArray

 public function testGroupByArray()
 {
     $stephenson = new Author();
     $stephenson->setFirstName("Neal");
     $stephenson->setLastName("Stephenson");
     $stephenson->save();
     $byron = new Author();
     $byron->setFirstName("George");
     $byron->setLastName("Byron");
     $byron->save();
     $phoenix = new Book();
     $phoenix->setTitle("Harry Potter and the Order of the Phoenix");
     $phoenix->setISBN("043935806X");
     $phoenix->setAuthor($stephenson);
     $phoenix->save();
     $qs = new Book();
     $qs->setISBN("0380977427");
     $qs->setTitle("Quicksilver");
     $qs->setAuthor($stephenson);
     $qs->save();
     $dj = new Book();
     $dj->setISBN("0140422161");
     $dj->setTitle("Don Juan");
     $dj->setAuthor($stephenson);
     $dj->save();
     $td = new Book();
     $td->setISBN("067972575X");
     $td->setTitle("The Tin Drum");
     $td->setAuthor($byron);
     $td->save();
     $authors = AuthorQuery::create()->leftJoinBook()->select(array('FirstName', 'LastName'))->withColumn('COUNT(Book.Id)', 'nbBooks')->groupBy(array('FirstName', 'LastName'))->orderByLastName()->find();
     $expectedSql = 'SELECT COUNT(book.id) AS nbBooks, author.first_name AS "FirstName", author.last_name AS "LastName" FROM author LEFT JOIN book ON (author.id=book.author_id) GROUP BY author.first_name,author.last_name ORDER BY author.last_name ASC';
     $this->assertEquals($expectedSql, $this->con->getLastExecutedQuery());
     $this->assertEquals(2, count($authors));
     $this->assertEquals('George', $authors[0]['FirstName']);
     $this->assertEquals(1, $authors[0]['nbBooks']);
     $this->assertEquals('Neal', $authors[1]['FirstName']);
     $this->assertEquals(3, $authors[1]['nbBooks']);
 }
开发者ID:SwissalpS,项目名称:Propel2,代码行数:39,代码来源:ModelCriteriaGroupByArrayTest.php

示例9: testFindOneWithOneToManyCustomOrder

 public function testFindOneWithOneToManyCustomOrder()
 {
     $author1 = new Author();
     $author1->setFirstName('AA');
     $author1->setLastName('AZ');
     $author2 = new Author();
     $author2->setFirstName('BB');
     $author2->setLastName('BZ');
     $book1 = new Book();
     $book1->setTitle('Aaa');
     $book1->setISBN('FA404-A');
     $book1->setAuthor($author1);
     $book1->save();
     $book2 = new Book();
     $book2->setTitle('Bbb');
     $book2->setISBN('FA404-B');
     $book2->setAuthor($author2);
     $book2->save();
     $book3 = new Book();
     $book3->setTitle('Ccc');
     $book3->setISBN('FA404-3');
     $book3->setAuthor($author1);
     $book3->save();
     $authors = AuthorQuery::create()->leftJoin('Propel\\Tests\\Bookstore\\Author.Book')->orderBy('Book.Title')->with('Book')->find();
     $this->assertEquals(2, count($authors), 'with() used on a many-to-many doesn\'t change the main object count');
 }
开发者ID:disider,项目名称:Propel2,代码行数:26,代码来源:ObjectFormatterWithTest.php

示例10: testSearchMatchesNotSimilarNewObjects

 public function testSearchMatchesNotSimilarNewObjects()
 {
     $col = new ObjectCollection();
     $b1 = new Book();
     $b1->setTitle('Bar');
     $b1->setISBN('012345');
     $b2 = clone $b1;
     $this->assertFalse($col->search($b1), 'search() returns false on an empty collection');
     $col = new ObjectCollection(array($b1));
     $this->assertTrue(0 === $col->search($b1));
     $this->assertFalse(0 === $col->search($b2));
 }
开发者ID:KyleGoslan,项目名称:Huge-Propel,代码行数:12,代码来源:ObjectCollectionTest.php

示例11: testFormatALotOfResults

 public function testFormatALotOfResults()
 {
     $nbBooks = 50;
     $con = Propel::getServiceContainer()->getConnection(BookTableMap::DATABASE_NAME);
     Propel::disableInstancePooling();
     $book = new Book();
     for ($i = 0; $i < $nbBooks; $i++) {
         $book->clear();
         $book->setTitle('BookTest' . $i);
         $book->setISBN('FA404-' . $i);
         $book->save($con);
     }
     $stmt = $con->query('SELECT * FROM book');
     $formatter = new OnDemandFormatter();
     $formatter->init(new ModelCriteria('bookstore', 'Propel\\Tests\\Bookstore\\Book'));
     $books = $formatter->format($stmt);
     $this->assertTrue($books instanceof OnDemandCollection, 'OnDemandFormatter::format() returns a PropelOnDemandCollection');
     $this->assertEquals($nbBooks, count($books), 'OnDemandFormatter::format() returns a collection that counts as many rows as the results in the query');
     $i = 0;
     foreach ($books as $book) {
         $this->assertTrue($book instanceof Book, 'OnDemandFormatter::format() returns a collection of Model objects');
         $this->assertEquals('BookTest' . $i, $book->getTitle(), 'OnDemandFormatter::format() returns the model objects matching the query');
         $i++;
     }
     Propel::enableInstancePooling();
 }
开发者ID:robin850,项目名称:Propel2,代码行数:26,代码来源:OnDemandFormatterTest.php

示例12: testMultiColFk

 /**
  * Testing foreign keys with multiple referrer columns.
  * @link       http://propel.phpdb.org/trac/ticket/606
  */
 public function testMultiColFk()
 {
     $con = Propel::getServiceContainer()->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:rouffj,项目名称:Propel2,代码行数:31,代码来源:GeneratedPeerDoSelectTest.php

示例13: testFindOneOrCreateMakesOneQueryWhenRecordExists

 public function testFindOneOrCreateMakesOneQueryWhenRecordExists()
 {
     $con = Propel::getServiceContainer()->getConnection(BookTableMap::DATABASE_NAME);
     BookQuery::create()->deleteAll($con);
     $book = new Book();
     $book->setTitle('Title');
     $book->setISBN('FA404');
     $book->setPrice(125);
     $book->save($con);
     $count = $con->getQueryCount();
     $book = BookQuery::create('b')->filterByPrice(125)->findOneOrCreate($con);
     $this->assertEquals($count + 1, $con->getQueryCount(), 'findOneOrCreate() makes only a single query when the record exists');
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:13,代码来源:ModelCriteriaTest.php

示例14: testQueryJoins

 /**
  *
  * @group mysql
  * @group pgsql
  */
 public function testQueryJoins()
 {
     if ($this->runningOnSQLite()) {
         $this->markTestSkipped('SQLite does not support right joins');
     }
     $author = new Author();
     $author->setFirstName('Steve');
     $author->setLastName('Bla');
     $author->save();
     $author2 = new Author();
     $author2->setFirstName('Blumen');
     $author2->setLastName('Hosen');
     $author2->save();
     $book = new Book();
     $book->setTitle('Book 1');
     $book->setISBN('12313');
     $book->save();
     $log = new PolymorphicRelationLog();
     $log->setMessage('author added');
     $log->setAuthor($author);
     $log->save();
     $log = new PolymorphicRelationLog();
     $log->setMessage('author added');
     $log->setAuthor($author2);
     $log->save();
     $log = new PolymorphicRelationLog();
     $log->setMessage('author changed');
     $log->setAuthor($author);
     $log->save();
     $log = new PolymorphicRelationLog();
     $log->setMessage('book added 1');
     $log->setBook($book);
     $log->save();
     $this->assertEquals(4, PolymorphicRelationLogQuery::create()->count());
     $logs = PolymorphicRelationLogQuery::create()->rightJoinAuthor()->with('Author')->orderById()->find();
     $this->assertCount(3, $logs);
     $this->assertEquals($author, $logs[0]->getAuthor());
     $this->assertEquals($author2, $logs[1]->getAuthor());
     $this->assertEquals($author, $logs[2]->getAuthor());
     $this->assertNull($logs[0]->getBook());
     $this->assertNull($logs[1]->getBook());
     $logs = PolymorphicRelationLogQuery::create()->rightJoinBook()->with('Book')->find();
     $this->assertCount(1, $logs);
     $this->assertEquals($book, $logs[0]->getBook());
     $this->assertNull($logs[0]->getAuthor());
     $logs = PolymorphicRelationLogQuery::create()->useAuthorQuery(null, Criteria::RIGHT_JOIN)->filterByFirstName('Steve')->endUse()->with('Author')->find();
     $this->assertCount(2, $logs);
     $logs = PolymorphicRelationLogQuery::create()->useAuthorQuery(null, Criteria::RIGHT_JOIN)->filterByFirstName('Blumen')->endUse()->with('Author')->find();
     $this->assertCount(1, $logs);
     $this->assertEquals(2, PolymorphicRelationLogQuery::create()->filterByTargetId($author->getId())->filterByTargetType('author')->count());
     $this->assertEquals(4, PolymorphicRelationLogQuery::create()->count());
     AuthorTableMap::clearInstancePool();
     $author3 = AuthorQuery::create()->leftJoinPolymorphicRelationLog()->with('PolymorphicRelationLog')->filterById($author->getId())->find()->get(0);
     $this->assertCount(2, $author3->getPolymorphicRelationLogs());
 }
开发者ID:SwissalpS,项目名称:Propel2,代码行数:60,代码来源:BookstoreLoggingTest.php

示例15: testScenarioUsingQuery

 public function testScenarioUsingQuery()
 {
     // Add publisher records
     // ---------------------
     try {
         $scholastic = new Publisher();
         $scholastic->setName("Scholastic");
         // do not save, will do later to test cascade
         $morrow = new Publisher();
         $morrow->setName("William Morrow");
         $morrow->save();
         $morrow_id = $morrow->getId();
         $penguin = new Publisher();
         $penguin->setName("Penguin");
         $penguin->save();
         $penguin_id = $penguin->getId();
         $vintage = new Publisher();
         $vintage->setName("Vintage");
         $vintage->save();
         $vintage_id = $vintage->getId();
         $this->assertTrue(true, 'Save Publisher records');
     } catch (Exception $e) {
         $this->fail('Save publisher records');
     }
     // Add author records
     // ------------------
     try {
         $rowling = new Author();
         $rowling->setFirstName("J.K.");
         $rowling->setLastName("Rowling");
         // do not save, will do later to test cascade
         $stephenson = new Author();
         $stephenson->setFirstName("Neal");
         $stephenson->setLastName("Stephenson");
         $stephenson->save();
         $stephenson_id = $stephenson->getId();
         $byron = new Author();
         $byron->setFirstName("George");
         $byron->setLastName("Byron");
         $byron->save();
         $byron_id = $byron->getId();
         $grass = new Author();
         $grass->setFirstName("Gunter");
         $grass->setLastName("Grass");
         $grass->save();
         $grass_id = $grass->getId();
         $this->assertTrue(true, 'Save Author records');
     } catch (Exception $e) {
         $this->fail('Save Author records');
     }
     // Add book records
     // ----------------
     try {
         $phoenix = new Book();
         $phoenix->setTitle("Harry Potter and the Order of the Phoenix");
         $phoenix->setISBN("043935806X");
         $phoenix->setAuthor($rowling);
         $phoenix->setPublisher($scholastic);
         $phoenix->save();
         $phoenix_id = $phoenix->getId();
         $this->assertFalse($rowling->isNew(), 'saving book also saves related author');
         $this->assertFalse($scholastic->isNew(), 'saving book also saves related publisher');
         $qs = new Book();
         $qs->setISBN("0380977427");
         $qs->setTitle("Quicksilver");
         $qs->setAuthor($stephenson);
         $qs->setPublisher($morrow);
         $qs->save();
         $qs_id = $qs->getId();
         $dj = new Book();
         $dj->setISBN("0140422161");
         $dj->setTitle("Don Juan");
         $dj->setAuthor($byron);
         $dj->setPublisher($penguin);
         $dj->save();
         $dj_id = $qs->getId();
         $td = new Book();
         $td->setISBN("067972575X");
         $td->setTitle("The Tin Drum");
         $td->setAuthor($grass);
         $td->setPublisher($vintage);
         $td->save();
         $td_id = $td->getId();
         $this->assertTrue(true, 'Save Book records');
     } catch (Exception $e) {
         $this->fail('Save Author records');
     }
     // Add review records
     // ------------------
     try {
         $r1 = new Review();
         $r1->setBook($phoenix);
         $r1->setReviewedBy("Washington Post");
         $r1->setRecommended(true);
         $r1->setReviewDate(time());
         $r1->save();
         $r1_id = $r1->getId();
         $r2 = new Review();
         $r2->setBook($phoenix);
         $r2->setReviewedBy("New York Times");
//.........这里部分代码省略.........
开发者ID:norfil,项目名称:Propel2,代码行数:101,代码来源:BookstoreTest.php


注:本文中的Propel\Tests\Bookstore\Book::setISBN方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。