本文整理汇总了PHP中Vendor::getVendorByVendorId方法的典型用法代码示例。如果您正苦于以下问题:PHP Vendor::getVendorByVendorId方法的具体用法?PHP Vendor::getVendorByVendorId怎么用?PHP Vendor::getVendorByVendorId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vendor
的用法示例。
在下文中一共展示了Vendor::getVendorByVendorId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetInvalidVendorByVendorId
/**
* test grabbing a Vendor that does not exist
**/
public function testGetInvalidVendorByVendorId()
{
// grab a vendor id that exceeds the maximum allowable vendor id
$vendor = Vendor::getVendorByVendorId($this->getPDO(), InventoryTextTest::INVALID_KEY);
$this->assertNull($vendor);
}
示例2: verifyXsrf
}
// post to a new Vendor
} else {
if ($method === "POST") {
// convert POSTed JSON to an object
verifyXsrf();
$requestContent = file_get_contents("php://input");
$requestObject = json_decode($requestContent);
$vendor = new Vendor(null, $requestObject->contactName, $requestObject->vendorEmail, $requestObject->vendorName, $requestObject->vendorPhoneNumber);
$vendor->insert($pdo);
$reply->data = "Vendor created OK";
// delete an existing Vendor
} else {
if ($method === "DELETE") {
verifyXsrf();
$vendor = Vendor::getVendorByVendorId($pdo, $vendorId);
$vendor->delete($pdo);
$reply->data = "Vendor deleted OK";
// put to an existing Vendor
} else {
if ($method === "PUT") {
// convert PUTed JSON to an object
verifyXsrf();
$requestContent = file_get_contents("php://input");
$requestObject = json_decode($requestContent);
$vendor = new Vendor($vendorId, $requestObject->contactName, $requestObject->vendorEmail, $requestObject->vendorName, $requestObject->vendorPhoneNumber);
$vendor->update($pdo);
$reply->data = "Vendor Updated Ok";
}
}
}
示例3: foreach
$allProducts = Product::getAllProducts($pdo, 0);
foreach ($allProducts as $product) {
$numberOfProducts = 0;
// Make an array of product location from the above product
$productLocations = ProductLocation::getProductLocationByProductId($pdo, $product->getProductId());
foreach ($productLocations as $productLocation) {
$numberOfProducts = $numberOfProducts + $productLocation->getQuantity();
}
// check if levels trigger notification according to alert operator
$productAlerts = ProductAlert::getProductAlertByProductId($pdo, $product->getProductId());
foreach ($productAlerts as $productAlert) {
$alertLevel = AlertLevel::getAlertLevelByAlertId($pdo, $productAlert->getAlertId());
if ($alertLevel->getAlertOperator() === "<" && $numberOfProducts < $alertLevel->getAlertPoint() || $alertLevel->getAlertOperator() === ">" && $numberOfProducts > $alertLevel->getAlertPoint()) {
// give warning
$productTitle = $product->getTitle();
$vendor = Vendor::getVendorByVendorId($pdo, $product->getVendorId());
$vendorName = $vendor->getVendorName();
$message = $message . <<<EOF
\t\t\t\t<tr>
\t\t\t\t\t<td>{$productTitle}</td>
\t\t\t\t\t<td>{$numberOfProducts}</td>
\t\t\t\t\t<td>{$vendorName}</td>
\t\t\t\t</tr>
EOF;
}
}
}
$message = $message . <<<EOF
\t\t\t</tbody>
EOF;
/**