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


PHP Book::getAuthor方法代码示例

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


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

示例1: testWeCanCreateABookWithInformation

 public function testWeCanCreateABookWithInformation()
 {
     $title = 'New Title';
     $author = "Author";
     $book = new Book($title, $author);
     $this->assertEquals($title, $book->getTitle());
     $this->assertEquals($author, $book->getAuthor());
 }
开发者ID:Witoso,项目名称:learningphp,代码行数:8,代码来源:BookTest.php

示例2: testGetAuthor

 function testGetAuthor()
 {
     //Arrange
     $title = "Grapes of Wrath";
     $test_book = new Book($title);
     $test_book->save();
     $first_name = "J.K.";
     $last_name = "Rowling";
     $test_author = new Author($first_name, $last_name);
     $test_author->save();
     $first_name2 = "John";
     $last_name2 = "Steinbeck";
     $test_author2 = new Author($first_name2, $last_name2);
     $test_author2->save();
     //Act
     $test_book->addAuthor($test_author);
     $test_book->addAuthor($test_author2);
     $result = $test_book->getAuthor();
     //Assert
     $this->assertEquals([$test_author, $test_author2], $result);
 }
开发者ID:jtorrespdx,项目名称:library,代码行数:21,代码来源:BookTest.php

示例3: testDoSelectJoin_NullFk

 /**
  * Test the doSelectJoin*() methods when the related object is NULL.
  */
 public function testDoSelectJoin_NullFk()
 {
     $b1 = new Book();
     $b1->setTitle("Test NULLFK 1");
     $b1->setISBN("NULLFK-1");
     $b1->save();
     $b2 = new Book();
     $b2->setTitle("Test NULLFK 2");
     $b2->setISBN("NULLFK-2");
     $b2->setAuthor(new Author());
     $b2->getAuthor()->setFirstName("Hans")->setLastName("L");
     $b2->save();
     BookPeer::clearInstancePool();
     AuthorPeer::clearInstancePool();
     $c = new Criteria();
     $c->add(BookPeer::ISBN, 'NULLFK-%', Criteria::LIKE);
     $c->addAscendingOrderByColumn(BookPeer::ISBN);
     $matches = BookPeer::doSelectJoinAuthor($c);
     $this->assertEquals(2, count($matches), "Expected 2 matches back from new books; got back " . count($matches));
     $this->assertNull($matches[0]->getAuthor(), "Expected first book author to be null");
     $this->assertInstanceOf('Author', $matches[1]->getAuthor(), "Expected valid Author object for second book.");
 }
开发者ID:RafalFilipek,项目名称:Propel2,代码行数:25,代码来源:GeneratedPeerDoSelectTest.php

示例4: locate

 function locate(Book $book)
 {
     // returns the position in the library
     // ie. shelf number & room number
     $libraryMap->findBookBy($book->getTitle(), $book->getAuthor());
 }
开发者ID:KLVTZ,项目名称:solid,代码行数:6,代码来源:Book.php

示例5: Book

<?php

require 'connect.php';
require 'client/Book.php';
require 'client/Employee.php';
require 'client/Client.php';
require 'client/Hire.php';
$book = new Book(1, 'Metro', 'Gluhowsky', 'apokalipsa');
$employee = new Employee(2, 'Jan', 'Kowalski', 'asdasdasdas@gmail.com', 'Warszawa');
$client = new Client(3, 'Anna', 'Kowalska', 'sadassdadas@o2.pl');
$hire = new Hire(4, $book, $employee, '2015-12-15', '2015-12-26');
$query = "INSERT INTO `book` (`id`, `title`, `author`, `type`) VALUES ('1', '{$book->getTitle()}', '{$book->getAuthor()}', '{$book->getType()}')";
$libraryRequest = mysql_query($query);
$query = "INSERT INTO `employee` (`id`, `firstname`, `lastname`, `email`, `city`) VALUES ('2', '{$employee->getfirstName()}', '{$employee->getlastName()}', '{$employee->getEmail()}', '{$employee->getCity()}')";
$libraryRequest = mysql_query($query);
$query = "INSERT INTO `client` (`id`, `firstname`, `lastname`, `email`) VALUES ('3', '{$client->getfirstName()}', '{$client->getlastName()}', '{$client->getEmail()}')";
$libraryRequest = mysql_query($query);
$query = "INSERT INTO `hire` (`id`, `id_client`, `id_book`, `id_employee`, `hiredate`, `returndate`) VALUES ('4', '{$client->getId()}', '{$book->getId()}', '{$employee->getId()}', '{$hire->getHireDate()}', '{$hire->getReturnDate()}')";
var_dump($query);
$libraryRequest = mysql_query($query);
开发者ID:przemek-kopaczewski,项目名称:library,代码行数:20,代码来源:index.php

示例6: __construct

 public function __construct(Book $book)
 {
     $this->setId($book->getId())->setTitle($book->getType())->setAuthor($book->getAuthor())->setType($book->getType())->setYear($book->getYear())->setPrice($book->getPrice());
 }
开发者ID:msobkowiak,项目名称:BookStore,代码行数:4,代码来源:EnhancedBook.php

示例7: testGetAuthor

 function testGetAuthor()
 {
     //Arrange
     $title = "Title";
     $id = 1;
     $test_book = new Book($title, $id);
     $test_book->save();
     $name = "Ping Pong";
     $id2 = 1;
     $test_author = new Author($name, $id2);
     $test_author->save();
     $name2 = "Ding Dong";
     $id3 = 2;
     $test_author2 = new Author($name2, $id3);
     $test_author2->save();
     //Act
     $test_book->addAuthor($test_author->getId());
     $test_book->addAuthor($test_author2->getId());
     //Assert
     $this->assertEquals($test_book->getAuthor(), [$test_author, $test_author2]);
 }
开发者ID:bdspen,项目名称:library,代码行数:21,代码来源:BookTest.php

示例8: SimpleXMLElement

}
$books = new SimpleXMLElement($xmlstr);
$aut = $books->book[0]->author;
$tit = $books->book[0]->title;
$gen = $books->book[0]->genre;
$pri = $books->book[0]->price;
$pub = $books->book[0]->publish_date;
$des = $books->book[0]->description;
$b = new Book();
//set with magic method __SET
$b->author = $aut;
$b->title = $tit;
$b->genre = $gen;
$b->price = $pri;
$b->publish_date = $pub;
$b->description = $des;
//get with magic method __GET
echo "with magic method __GET<br/>";
echo $b->author;
echo $b->title;
echo $b->genre;
echo $b->price;
echo $b->publish_date;
echo $b->description;
echo "<br/>with magic method __CALL<br/>";
echo $b->getAuthor();
echo $b->getTitle();
echo $b->getGenre();
echo $b->getPrice();
echo $b->getPublish_date();
echo $b->getDescription();
开发者ID:AlanBallesteros,项目名称:EjerciciosDiarios,代码行数:31,代码来源:php13.php

示例9: testAddAuthor

 function testAddAuthor()
 {
     //Arrange
     $title = "Grapes of Wrath";
     $test_book = new Book($title);
     $test_book->save();
     $title2 = "Cannery Row";
     $test_book2 = new Book($title2);
     $test_book2->save();
     $author_first = "John";
     $author_last = "Steinbeck";
     $test_author = new Author($author_first, $author_last);
     $test_author->save();
     //Act
     $test_book->addAuthor($test_author);
     //Assert
     $this->assertEquals($test_book->getAuthor(), [$test_author]);
 }
开发者ID:alexMcosta,项目名称:library2,代码行数:18,代码来源:BookTest.php

示例10: save

 function save(Book $book)
 {
     $filename = '/documents/' . $book->getTitle() . ' - ' . $book->getAuthor();
     file_put_contents($filename, serialize($book));
 }
开发者ID:asbag,项目名称:SOLIDpatterns,代码行数:5,代码来源:file.php

示例11: printItemRow

/**
 * Prints the metadata and prices for an item
 * @param Item|Book $item   an Item (Section mode) or Book (ISBN mode) object
 * @param int $requiredStatus
 */
function printItemRow($item, $status = null)
{
    global $app;
    ?>
    <tr>
        <th>
            <span class="tooltip" style="display: none;">
                <img src="<?php 
    echo $item->getImageUrl();
    ?>
">
                <h1><?php 
    echo $item->getTitle();
    ?>
</h1>
                <h2><?php 
    echo $item->getAuthor();
    ?>
</h2>
                <?php 
    if ($edition = $item->getEdition()) {
        ?>
                    <div class="edition"><strong>Edition:</strong> <?php 
        echo $edition;
        ?>
</div>
                <?php 
    }
    if ($publisher = $item->getPublisher()) {
        ?>
                    <div class="publisher"><strong>Publisher:</strong> <?php 
        echo $publisher;
        ?>
</div>
                <?php 
    }
    if ($isbn = $item->getIsbn()) {
        ?>
                    <div class="isbn"><strong>ISBN:</strong> <span class="isbn"><?php 
        echo $isbn;
        ?>
</span></div>
                <?php 
    }
    ?>
            </span>
            <?php 
    $indented = $item->isPackageComponent() || $status === SectionHasItem::BOOKSTORE_RECOMMENDED;
    $class = $indented ? " packageComponent" : "";
    ?>

            <span class="bookdata <?php 
    echo $class;
    ?>
">
                <span class="title"><?php 
    echo $item->getTitle();
    ?>
</span><br>
                <?php 
    if ($edition || $item->getAuthor()) {
        ?>
                <span class="minimetadata"><?php 
        echo ($edition ? "{$edition}, " : "") . $item->getAuthor();
        ?>
</span>
                <?php 
    }
    ?>
                <?php 
    // e.g. (Recommended)
    if ($stat = Item::getStatusText($status)) {
        ?>
                    <br/><span class="minimetadata"><?php 
        echo $stat;
        ?>
</span>
                <?php 
    }
    // sentence about being a package or component
    if ($description = $item->getDescription($status)) {
        ?>
                    <br/><span class="minimetadata important"><?php 
        echo $description;
        ?>
</span>
                <?php 
    }
    ?>
            </span>
        </th>

    <?php 
    foreach ($item->prices as $v => $p) {
        if ($p === null) {
//.........这里部分代码省略.........
开发者ID:therealchiko,项目名称:getchabooks,代码行数:101,代码来源:table.php


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