本文整理汇总了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()));
}
}