本文整理汇总了PHP中Inventory::__build方法的典型用法代码示例。如果您正苦于以下问题:PHP Inventory::__build方法的具体用法?PHP Inventory::__build怎么用?PHP Inventory::__build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory::__build方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBuild
/** @depends testConstruct */
public function testBuild()
{
$inv = Inventory::__build(1, 1000, 1);
$this->assertEquals(1, $inv->id);
$this->assertEquals(1000, $inv->date);
$this->assertEquals(1, $inv->locationId);
}
示例2: proceed
protected function proceed()
{
$srv = new InventoriesService();
switch ($this->action) {
case 'save':
$jsInv = json_decode($this->getParam("inventory"));
$id = null;
if (!property_exists($jsInv, 'id')) {
$jsInv->id = null;
}
$inv = Inventory::__build($jsInv->id, $jsInv->date, $jsInv->locationId);
foreach ($jsInv->items as $item) {
if (!property_exists($item, 'missingQty')) {
$item->missingQty = null;
}
if (!property_exists($item, 'unitValue')) {
$item->unitValue = null;
}
if (!property_exists($item, "attrSetInstId")) {
$item->attrSetInstId = null;
}
$item = new InventoryItem($inv->id, $item->productId, $item->attrSetInstId, $item->qty, $item->lostQty, $item->defectQty, $item->missingQty, $item->unitValue);
$inv->addItem($item);
}
$inv->fillZero();
$id = $srv->create($inv);
if ($id !== false) {
$this->succeed($id);
} else {
$this->fail(APIError::$ERR_GENERIC);
}
break;
}
}
示例3: build
protected function build($dbInv, $pdo = null)
{
$db = DB::get();
$inv = Inventory::__build($dbInv['ID'], $db->readDate($dbInv['DATE']), $dbInv['LOCATION_ID'], $dbInv['PRODUCT_ID'], $dbInv['ATTRSETINST_ID'], $dbInv['QTY'], $dbInv['LOSTQTY'], $dbInv['DEFECTQTY'], $dbInv['MISSINGQTY'], $dbInv['UNITVALUE']);
$stmt = $pdo->prepare("SELECT * FROM STOCK_INVENTORYCONTENT WHERE " . "INVENTORY_ID = :id");
$stmt->bindParam(":id", $dbInv['ID']);
$stmt->execute();
while ($row = $stmt->fetch()) {
$item = new InventoryItem($row['PRODUCT_ID'], $row['ATTRSETINST_ID'], $row['QTY'], $row['LOSTQTY'], $row['DEFECTQTY'], $row['MISSINGQTY'], $row['UNITVALUE']);
$inv->addItem($item);
}
return $inv;
}