本文整理汇总了PHP中Book::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Book::setName方法的具体用法?PHP Book::setName怎么用?PHP Book::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Book
的用法示例。
在下文中一共展示了Book::setName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findOne
/**
* fake for test
*/
public function findOne($con = null)
{
if (true === $this->bySlug) {
$book = new Book();
$book->setId(1);
$book->setName('My Book');
$book->setSlug('my-book');
return $book;
}
return null;
}
示例2: handlePUT
function handlePUT()
{
$conn = Connection::startConnection();
parse_str(file_get_contents("php://input"), $data);
header('Content-type: application/json');
$book = new Book();
$book->setName($data['name']);
$book->setAuthor($data['author']);
$book->setDesc($data['opis']);
$book->updateBook($conn, $data['id']);
Connection::stopConnecion($conn);
}
示例3: findOrCreateOne
public function findOrCreateOne($book_name)
{
# Attempt to find book
$book = BookQuery::create()->filterByName($book_name)->findOne();
# Return or create book
if ($book) {
return $book;
} else {
$book = new Book();
$book->setName($book_name)->save();
return $book;
}
}
示例4: setName
public function setName($newName)
{
parent::setName($newName . " - wersja cyfrowa");
}
示例5: getName
<?php
trait NameTrait
{
private $name;
public function getName()
{
return $this->name;
}
public function setName($name)
{
return $this->name = $name;
}
}
class Book
{
use NameTrait;
}
$book = new Book();
$book->setName('PHP Cookbook');
print $book->getName();