本文整理匯總了PHP中DaoFactory::getFactory方法的典型用法代碼示例。如果您正苦於以下問題:PHP DaoFactory::getFactory方法的具體用法?PHP DaoFactory::getFactory怎麽用?PHP DaoFactory::getFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DaoFactory
的用法示例。
在下文中一共展示了DaoFactory::getFactory方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendTradeRegisteredNotification
function sendTradeRegisteredNotification($tradeObj)
{
if ($tradeObj) {
try {
//Get target emails
$userDao = DaoFactory::getFactory()->getUserDao();
$buyerData = $userDao->getUserByUid($tradeObj->getBuyerUid());
$sellerData = $userDao->getUserByUid($tradeObj->getSellerUid());
$enteredByData = $userDao->getUserByUid($tradeObj->getEnteredByUid());
$object = new stdClass();
$object->description = $tradeObj->getDescription();
$object->amount = $tradeObj->getAmount();
$object->buyerFullLabel = $buyerData['firstname'] . " " . $buyerData['surname'] . " [" . $tradeObj->getBuyerUid() . "]";
$object->sellerFullLabel = $sellerData['firstname'] . " " . $sellerData['surname'] . " [" . $tradeObj->getSellerUid() . "]";
$object->enteredByFullLabel = $enteredByData['firstname'] . " " . $enteredByData['surname'] . " [" . $tradeObj->getEnteredByUid() . "]";
//die(var_dump($object));
$message = $this->buildHtmlTradeNotification($object);
//echo "<br>message-->".$message;
$title = "Intercambio registrado";
if ($buyerData['email']) {
$this->sendEmail($buyerData['email'], $title, $message);
}
if ($sellerData['email']) {
$this->sendEmail($sellerData['email'], $title, $message);
}
$this->sendEmail("bdt.sietepicos@gmail.com", $title, $message);
} catch (Exception $e) {
throw new Exception("Email notification problem occured" . $e->getMessage());
}
}
}
示例2: deleteTradeById
function deleteTradeById($tradeId)
{
$tradeDao = DaoFactory::getFactory()->getTradeDao();
try {
$tradeObj = $tradeDao->getTradeById($tradeId);
$tradeDao->deleteTradeSQL($tradeId);
//Update seller / buyer credits
$userDao = DaoFactory::getFactory()->getUserDao();
$userDao->updateUserCredit($tradeObj['seller']);
$userDao->updateUserCredit($tradeObj['buyer']);
return json_encode((object) array(code => 'OK', message => 'Trade successfully removed'));
} catch (Exception $e) {
return json_encode((object) array(code => 'KO', message => $e->getMessage()));
}
}