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


PHP Book::getId方法代码示例

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


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

示例1: removeBook

 /**
  * Remove book from student (lost or returned to library @see Library )
  *
  * @param Book $book
  *
  * @throws Exception
  */
 public function removeBook(Book $book)
 {
     if (in_array($this->books, $book->getId())) {
         if (($key = array_search($book->getId(), $this->books)) !== false) {
             unset($this->books[$key]);
         }
     } else {
         throw new Exception("Warning, book cannot be deleted - there are no such book owned by student");
     }
 }
开发者ID:Tidynar,项目名称:University,代码行数:17,代码来源:Man.php

示例2: testGetId

 function testGetId()
 {
     $name = "Randy Mclure";
     $test_patron = new Book($name);
     $result = $test_patron->getId();
     $this->assertEquals(null, $result);
 }
开发者ID:umamiMike,项目名称:Library,代码行数:7,代码来源:PatronTest.php

示例3: testGetId

 function testGetId()
 {
     $name = "Stephen King";
     $test_author = new Book($name);
     $result = $test_author->getId();
     $this->assertEquals(null, $result);
 }
开发者ID:umamiMike,项目名称:Library,代码行数:7,代码来源:AuthorTest.php

示例4: testGetId

 function testGetId()
 {
     $book_name = "Siddhartha";
     $id = 100;
     $test_book = new Book($book_name, $id);
     $result = $test_book->getId();
     $this->assertEquals($id, $result);
 }
开发者ID:JordanNavratil,项目名称:Library,代码行数:8,代码来源:BookTest.php

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

示例6: testFind

 function testFind()
 {
     $title = "Anathem";
     $test_book = new Book($title);
     $test_book->save();
     $title2 = "Snow Crash";
     $test_book2 = new Book($title2);
     $test_book2->save();
     $result = Book::find($test_book->getId());
     $this->assertEquals($result, $test_book);
 }
开发者ID:umamiMike,项目名称:library-1,代码行数:11,代码来源:BookTest.php

示例7: Book

 function test_find()
 {
     $title = "Three Blind Mice";
     $test_book = new Book($title);
     $test_book->save();
     $title2 = "Chicken Dog";
     $test_book2 = new Book($title2);
     $test_book2->save();
     $result = Book::find($test_book->getId());
     $this->assertEquals($test_book, $result);
 }
开发者ID:nathanhwyoung,项目名称:Library-2,代码行数:11,代码来源:BookTest.php

示例8: testGetBook

 function testGetBook()
 {
     $title = "Carrie";
     $test_book = new Book($title);
     $test_book->save();
     $book_id = $test_book->getId();
     $test_copy = new Copy($book_id);
     $test_copy->save();
     $result = $test_copy->getBook();
     $this->assertEquals($test_book, $result);
 }
开发者ID:umamiMike,项目名称:Library,代码行数:11,代码来源:CopyTest.php

示例9: testGetId

 function testGetId()
 {
     //Arrange
     $title = "Grapes of Wrath";
     $id = 1;
     $test_book = new Book($title, $id);
     //Act
     $result = $test_book->getId();
     //Assert
     $this->assertEquals(1, $result);
 }
开发者ID:jtorrespdx,项目名称:library_catalog,代码行数:11,代码来源:BookTest.php

示例10: testFind

 function testFind()
 {
     //Arrange
     $id = null;
     $name = "A Series of Unfortunate Events";
     $test_book = new Book($id, $name);
     $test_book->save();
     $name2 = "Fresh Off the Boat";
     $test_book2 = new Book($id, $name2);
     $test_book2->save();
     //Act
     $result = Book::find($test_book->getId());
     //Assert
     $this->assertEquals($test_book, $result);
 }
开发者ID:kellimargaret,项目名称:2015.08.26.Library,代码行数:15,代码来源:BookTest.php

示例11: Book

 function test_find()
 {
     //Arrange
     $title = "The Cat in the Hat";
     $test_book = new Book($title);
     $test_book->save();
     $title2 = "Misery";
     $test_book2 = new Book($title2);
     $test_book2->save();
     //Act
     $id = $test_book->getId();
     $result = Book::find($id);
     //Assert
     $this->assertEquals($test_book, $result);
 }
开发者ID:jtorrespdx,项目名称:library,代码行数:15,代码来源:BookTest.php

示例12: testFind

 function testFind()
 {
     //Arrange
     $title = "Harry Potter";
     $id = 1;
     $test_book = new Book($title, $id);
     $test_book->save();
     $title2 = "Moby Dick";
     $id2 = 2;
     $test_book2 = new Book($title, $id);
     $test_book2->save();
     //Act
     $result = Book::find($test_book2->getId());
     //Assert
     $this->assertEquals($test_book2, $result);
 }
开发者ID:bborealis,项目名称:library,代码行数:16,代码来源:BookTest.php

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

示例14: testAddCheckout

 function testAddCheckout()
 {
     $title = "Three Blind Mice";
     $test_book = new Book($title);
     $test_book->save();
     $test_copy = new Copy($amount = 1, $test_book->getId());
     $test_copy->save();
     $name = "Joe Bongtana";
     $test_patron = new Patron($name);
     $test_patron->save();
     $due_date = "01-01-2016";
     $status = 1;
     $test_checkout = new Checkout($test_copy->getId(), $test_patron->getId(), $due_date, $status);
     $test_checkout->save();
     $test_patron->addCheckout($test_checkout);
     $result = Checkout::getAll();
     $this->assertEquals($test_checkout, $result);
 }
开发者ID:nathanhwyoung,项目名称:Library-2,代码行数:18,代码来源:PatronTest.php

示例15: testSaveCanInsertNonEmptyObjects

 public function testSaveCanInsertNonEmptyObjects()
 {
     $b = new Book();
     $b->setTitle('foo');
     $b->setIsbn('124');
     $b->save();
     $this->assertFalse($b->isNew());
     $this->assertNotNull($b->getId());
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:9,代码来源:GeneratedObjectTest.php


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