本文整理汇总了PHP中Item::getDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::getDescription方法的具体用法?PHP Item::getDescription怎么用?PHP Item::getDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item::getDescription方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gettersShouldReturnTheAttributeValue
/**
* @test
*/
public function gettersShouldReturnTheAttributeValue()
{
$this->assertAttributeEquals($this->item->getId(), 'id', $this->item);
$this->assertAttributeEquals($this->item->getDescription(), 'description', $this->item);
$this->assertAttributeEquals($this->item->getAmount(), 'amount', $this->item);
$this->assertAttributeEquals($this->item->getQuantity(), 'quantity', $this->item);
$this->assertAttributeEquals($this->item->getShippingCost(), 'shippingCost', $this->item);
$this->assertAttributeEquals($this->item->getWeight(), 'weight', $this->item);
}
示例2: testSetGetDescription
public function testSetGetDescription()
{
// Arrange
$item = new Item();
$item->setDescription('this is an item description');
$expectedResult = 'this is an item description';
// Act
$result = $item->getDescription();
// Assert
$this->assertEquals($result, $expectedResult);
}
示例3: updateItem
/**
*
* @param Item $item
* @return type
* @throws DaoException
*/
public function updateItem(Item $item)
{
try {
$query = Doctrine_Query::create()->update('Item i');
$query->set('i.name', '?', $item->getName());
$query->set('i.sales_unit_price', '?', $item->getSalesUnitPrice());
$query->set('i.purchase_unit_price', '?', $item->getPurchaseUnitPrice());
$query->set('i.description', '?', $item->getDescription());
$query->set('i.stock_available', '?', $item->getStockAvailable());
$query->where('i.id = ?', $item->getId());
return $query->execute();
} catch (Exception $e) {
throw new DaoException($e->getMessage(), $e->getCode(), $e);
}
}
示例4: create
/**
* @param Subcategory $subcategory
* @param $name
* @param $descr
* @param $short_descr
* @param $price
* @param $stock
* @return array
* @throws Exception
*/
public function create(Subcategory $subcategory, $name, $descr, $short_descr, $price, $stock)
{
$errors = array();
$item = new Item($this->db);
try {
$item->setName($name);
$item->setDescription($descr);
$item->setShortDescription($short_descr);
$item->setPrice($price);
$item->setStock($stock);
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
if (count($errors) == 0) {
$name = $this->db->quote($item->getName());
$description = $this->db->quote($item->getDescription());
$shortDescription = $this->db->quote($item->getShortDescription());
$price = $this->db->quote($item->getPrice());
$stock = $this->db->quote($item->getStock());
$query = " INSERT INTO item(id_subcategory, name, descr, short_descr, price, stock)\n VALUES(" . $subcategory->getId() . ", " . $name . ", " . $description . ", " . $shortDescription . ", " . $price . ", " . $stock . ")";
$data = $this->db->exec($query);
if ($data) {
$id = $this->db->lastInsertId();
if ($id) {
try {
return $this->findById($id);
} catch (Exception $e) {
$errors[] = $e->getMessage();
return $errors;
}
} else {
throw new Exception('Last insert error');
}
} else {
throw new Exception('Db error');
}
} else {
return $errors;
}
}
示例5: testUpdate
function testUpdate()
{
//Arrange
$description = "Pliny the Elder";
$cost = 5.0;
$id = null;
$test_item = new Item($description, $cost, $id);
$test_item->save();
$new_description = "Pliny the Younger";
$new_cost = 10.0;
//Act
$test_item->update($new_description, $new_cost);
//Assert
$this->assertEquals($new_description, $test_item->getDescription());
$this->assertEquals($new_cost, $test_item->getCost());
}
示例6: testSetDescription
/**
* @covers Debril\RssAtomBundle\Protocol\Parser\Item::setDescription
*/
public function testSetDescription()
{
$newDescription = 'A brand new description';
$this->object->setDescription($newDescription);
$this->assertEquals($newDescription, $this->object->getDescription());
}
示例7: update
public function update(Item $item)
{
$idCategory = $item->getCategory()->getId();
$id = intval($id);
$name = $this->db->quote($item->getName());
$price = $this->db->quote($item->getPrice());
$stock = $this->db->quote($item->getStock());
$image = $this->db->quote($item->getImage());
$description = $this->db->quote($item->getDescription());
$query = ' UPDATE item
SET name=' . $name . ',
price=' . $price . ',
stock=' . $stock . ',
image=' . $image . ',
description=' . $description . ',
id_category=' . $idCategory . '
WHERE id=' . $id;
$res = $this->db->exec($query);
if ($res) {
$id = $this->db->lastInsertId();
if ($id) {
return $this->findByID($id);
} else {
throw new Exception('Internal server Error');
}
}
}
示例8: 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) {
//.........这里部分代码省略.........
示例9: dolog
/**
* Short description of method dolog
*
* @access public
* @author Joel Bout, <joel.bout@tudor.lu>
* @param Item item
* @return mixed
*/
public function dolog(Item $item)
{
// section 127-0-1-1--13fe8a1d:134184f8bc0:-8000:0000000000001852 begin
if (is_null($this->filehandle)) {
$this->initFile();
}
if ($this->filehandle !== false) {
$map = array('%d' => date('Y-m-d H:i:s', $item->getDateTime()), '%m' => $item->getDescription(), '%s' => $item->getSeverityDescriptionString(), '%t' => $item->getDateTime(), '%r' => $item->getRequest(), '%f' => $item->getCallerFile(), '%l' => $item->getCallerLine());
if (strpos($this->format, '%b')) {
$map['%b'] = 'Backtrace not yet supported';
}
$str = strtr($this->format, $map) . "\n";
@fwrite($this->filehandle, $str);
}
// section 127-0-1-1--13fe8a1d:134184f8bc0:-8000:0000000000001852 end
}