本文整理汇总了PHP中Dao类的典型用法代码示例。如果您正苦于以下问题:PHP Dao类的具体用法?PHP Dao怎么用?PHP Dao使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dao类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: outPut
/**
* 输出出仓数据
*
* @param $data
*/
public function outPut($data, $dbconfig)
{
//无条码不用做
if (!$data["code"]) {
return true;
}
$unicode = $dbconfig['unicode'];
if (!$unicode) {
$unicode = 'gb2312';
}
$billtypedao = new BilltypeDao();
$billtype = $data["billType"];
$result = $billtypedao->find("billtypeDesc='{$billtype}'");
$result = $result->toArray();
if ($result["stype"] != 'OUT') {
return true;
}
$dao = new Dao('', 'jk_dnb_hgk_send', '', false, $dbconfig);
$dao->startTrans();
try {
if ($data["memo"] == '电能表') {
$sql = "insert into jk_dnb_hgk_recieve (fc_tm) values('" . $data["code"] . "')";
} else {
$sql = "insert into jk_hgq_hgk_recieve (fc_tm) values('" . $data["code"] . "')";
}
$sql = $this->auto_charset($sql, 'utf8', $unicode);
$result = $dao->execute($sql);
} catch (Exception $e) {
$dao->rollback();
throw new Exception($e);
}
$dao->commit();
return true;
}
开发者ID:kenlong,项目名称:example,代码行数:39,代码来源:BXIF.class.php
示例2: testGettingReferenceCachesTheReference
/**
* @covers Dao::getReference
*/
public function testGettingReferenceCachesTheReference()
{
$reference = $this->getMockForAbstractClass('BasicDaoReference', array(), '', false);
$this->dao->expects($this->once())->method('getUserReference')->will($this->returnValue($reference));
self::assertEquals($reference, $this->dao->getReference('user'));
self::assertEquals($reference, $this->dao->getReference('user'));
}
开发者ID:enyo,项目名称:rincewind,代码行数:10,代码来源:Dao.ReferenceTest.php
示例3: exec
public function exec($sql, $dbconfig, $unicode = 'gb2312')
{
$dao = new Dao('', 'jk_dnb_hgk_send', '', false, $dbconfig);
$sql = $this->auto_charset($sql, 'utf8', $unicode);
if (strpos($sql, 'select') !== false) {
$result = $dao->query($sql)->toArray();
if ($result) {
$result = $this->auto_charset($result, $unicode, 'utf8');
for ($i = 0; $i < count($result); $i++) {
for ($j = count($result[$i]); $j >= 0; $j--) {
unset($result[$i][$j]);
}
}
$rtn["result"] = true;
$rtn["value"] = $result;
} else {
$rtn["result"] = false;
}
} else {
$result = $dao->execute($sql);
if ($result) {
$rtn["result"] = true;
$rtn["value"] = $result;
} else {
$rtn["result"] = false;
}
}
return $rtn;
}
开发者ID:kenlong,项目名称:example,代码行数:29,代码来源:SQLTest.php
示例4: handle
public function handle()
{
$dao = new \Dao();
$date = time();
$sql = "INSERT INTO `Group`.`groups` (`id`, `title`) VALUES (NULL, {$date});";
$dao->querySql($sql, 'default');
}
开发者ID:fucongcong,项目名称:framework,代码行数:7,代码来源:TestSql.php
示例5: insert
public function insert()
{
$sqlCommand = "INSERT INTO usuario_admin (nome)" . " VALUES (:nome)";
$paramters = array();
$paramters[':nome'] = $this->getNome();
$dao = new Dao();
return $dao->executeCommand($sqlCommand, $paramters);
}
开发者ID:karenAle,项目名称:DAW2_2_2015_PEDIDOS,代码行数:8,代码来源:UsuarioModel.php
示例6: __construct
function __construct($owner, $delegate, Dao $dao, TableField $field)
{
$this->owner = $owner;
$this->delegate = $delegate;
$this->dao = $dao;
$this->reflectionClass = new \ReflectionClass($dao->getEntityClass());
$this->field = $field;
}
开发者ID:netbrain,项目名称:simphple-orm,代码行数:8,代码来源:EntityProxy.php
示例7: testReferenceGetsByIdIfPresentDataIsInt
/**
* @covers DaoToOneReference::getReferenced
*/
public function testReferenceGetsByIdIfPresentDataIsInt()
{
$this->getMockForAbstractClass('Dao', array('createDao'), 'BBB_NotAbstractDao2', false);
$this->dao = $this->getMock('BBB_NotAbstractDao2', array('getRecordFromData'), array(), '', false);
$this->record->expects($this->once())->method('getDirectly')->with('address')->will($this->returnValue(123));
$this->dao->expects($this->once())->method('getRecordFromData')->with(array('id' => 123), true, false)->will($this->returnValue('RECORD'));
$reference = new DaoToOneReference($this->dao, 'localKey', 'foreignKey');
self::assertSame('RECORD', $reference->getReferenced($this->record, 'address'));
}
开发者ID:enyo,项目名称:rincewind,代码行数:12,代码来源:DaoToOneReferenceTest.php
示例8: testRecordCallsLoadIfAnAttributeWasNotSetYet
public function testRecordCallsLoadIfAnAttributeWasNotSetYet()
{
$record = new Record(array('id' => 4), $this->dao, TRUE);
$this->dao->expects($this->any())->method('getAttributes')->will($this->returnValue(array('id' => Dao::INT, 'name' => Dao::STRING)));
$this->dao->expects($this->once())->method('getData')->with(array('id' => 4))->will($this->returnValue(array('id' => 4, 'name' => 'Test')));
self::assertEquals('Test', $record->get('name'));
self::assertEquals('Test', $record->get('name'));
// Checking it doesn't load twice
}
开发者ID:enyo,项目名称:rincewind,代码行数:9,代码来源:Record.LazyLoading.php
示例9: Entry
function Entry()
{
$dao = new Dao();
$getIn = new Dao_GetRulesIn();
$getIn->user = LoginGetUser();
$getOut = new Dao_GetRulesOut();
$addIn->user = LoginGetUser();
$dao->GetRules($getIn, $getOut);
CgiOutput($getOut->errorCode, $geeOut->errorMessage, $getOut->rules);
}
开发者ID:lionker,项目名称:cpp_learn,代码行数:10,代码来源:cgi_query_rules.php
示例10: updateFaixaDescontoPermitido
public static function updateFaixaDescontoPermitido()
{
$FaixaDescontoPermitidoTO = new FaixaDescontoPermitidoTO();
$FaixaDescontoPermitidoDao = new FaixaDescontoPermitidoDao();
$validator = new DataValidator();
$FaixaDescontoPermitidoTO->id = isset($_POST["id"]) ? $_POST["id"] : null;
$FaixaDescontoPermitidoTO->perc_desconto_max = isset($_POST["perc_desconto_max"]) ? $_POST["perc_desconto_max"] : null;
$FaixaDescontoPermitidoTO->id_empreendimento = isset($_POST["id_empreendimento"]) ? $_POST["id_empreendimento"] : null;
$usuarios = isset($_POST["usuarios"]) && count($_POST["usuarios"]) > 0 ? $_POST["usuarios"] : false;
$delete_usuarios = isset($_POST["delete_usuarios"]) && count($_POST["delete_usuarios"]) > 0 ? $_POST["delete_usuarios"] : false;
$validator->set_msg('O ID da faixa é obrigatório')->set('id', $FaixaDescontoPermitidoTO->id)->is_required();
$validator->set_msg('Informe o valor máximo de desconto desta faixa')->set('perc_desconto_max', $FaixaDescontoPermitidoTO->perc_desconto_max)->is_required();
$validator->set_msg('O id do empreendimento é obrigatório')->set('id_empreendimento', $FaixaDescontoPermitidoTO->id_empreendimento)->is_required();
if ($FaixaDescontoPermitidoDao->verificarFaixa($FaixaDescontoPermitidoTO->perc_desconto_max, $FaixaDescontoPermitidoTO->id_empreendimento, $FaixaDescontoPermitidoTO->id) && $FaixaDescontoPermitidoTO->perc_desconto_max > 0) {
$validator->_errors['perc_desconto_max'][] = 'Já existe outra faixa com este valor máximo ';
}
if (!$validator->validate()) {
Flight::response()->status(406)->header('Content-Type', 'application/json')->write(json_encode($validator->get_errors()))->send();
return;
}
$lastInsertId = $FaixaDescontoPermitidoDao->updateFaixaDescontoPermitido($FaixaDescontoPermitidoTO);
if ($lastInsertId) {
$UsuarioFaixaDescontoPermitidoDao = new UsuarioFaixaDescontoPermitidoDao();
$UsuarioFaixaDescontoPermitidoTO = new UsuarioFaixaDescontoPermitidoTO();
if ($usuarios) {
$Dao = new Dao();
$Dao->setTimeZone($FaixaDescontoPermitidoTO->id_empreendimento);
$UsuarioFaixaDescontoPermitidoTO->dta_entrada = date('Y-m-d H:i:s');
foreach ($usuarios as $usuario) {
$UsuarioFaixaDescontoPermitidoTO->id_usuario = $usuario['id_usuario'];
$UsuarioFaixaDescontoPermitidoTO->id_faixa_desconto_permitido = $FaixaDescontoPermitidoTO->id;
$UsuarioFaixaDescontoPermitidoTO->flg_ativo = $usuario['flg_ativo'];
$UsuarioFaixaDescontoPermitidoTO->id_responsavel_atv = $usuario['id_responsavel_atv'];
if (!$UsuarioFaixaDescontoPermitidoDao->saveUsuarioFaixaDescontoPermitido($UsuarioFaixaDescontoPermitidoTO)) {
Flight::halt(500, 'Erro ao vincular usuario a faixa ');
}
}
}
if ($delete_usuarios) {
foreach ($delete_usuarios as $usuario) {
if (!$UsuarioFaixaDescontoPermitidoDao->deleteUsuarioFaixaDescontoPermitido($usuario['id_rel'])) {
Flight::halt(500, 'Erro ao deletar usuario');
}
}
}
Flight::halt(201);
} else {
Flight::halt(500, 'Erro ao inserir Desconto');
}
}
开发者ID:filipecoelho,项目名称:webliniaerp-api,代码行数:50,代码来源:FaixaDescontoPermitidoController.php
示例11: Entry
function Entry()
{
$ruleId = CgiInput("rule_id", "");
if ($ruleId == "") {
CgiOutput(__LINE__, "");
}
$dao = new Dao();
$delIn = new Dao_DeleteRuleIn();
$delOut = new Dao_DeleteRuleOut();
$delIn->user = LoginGetUser();
$delIn->ruleId = $ruleId;
$dao->DeleteRule($delIn, $delOut);
CgiOutput($delOut->errorCode, $delOut->errorMessage);
}
开发者ID:lionker,项目名称:cpp_learn,代码行数:14,代码来源:cgi_delete_rule.php
示例12: updateSetting
public function updateSetting($sender, $param)
{
$result = $errors = array();
try {
$result = $products = array();
$systemSetting = SystemSettings::getByType(SystemSettings::TYPE_SYSTEM_BUILD_PRODUCTS_ID);
foreach ($param->CallbackParameter as $type => $ids) {
$result[$type] = array();
$products[$type] = array();
foreach ($ids as $index => $id) {
$id = intval(trim($id));
if (($product = Product::get($id)) instanceof Product) {
$result[$type][] = $id;
$products[$type][] = $product->getJson();
}
}
}
Dao::beginTransaction();
$systemSetting->setValue(json_encode($result))->save();
Dao::commitTransaction();
} catch (Exception $ex) {
// Dao::rollbackTransaction();
$errors[] = $ex->getMessage();
}
$param->ResponseData = StringUtilsAbstract::getJson($products, $errors);
}
开发者ID:larryu,项目名称:magento-b2b,代码行数:26,代码来源:BuildController.php
示例13: run
public static function run()
{
try {
Dao::beginTransaction();
$start = self::_logMsg("== START: processing Product Ageing ==", __CLASS__, __FUNCTION__);
self::_emptyProductAgeingLog();
$productCount = 0;
$products = self::_getProducts();
if (self::DEBUG === true) {
self::_logMsg('ProductCount: ' . count($products), __CLASS__, __FUNCTION__);
}
foreach ($products as $product) {
$productCount++;
if (self::DEBUG === true) {
self::_logMsg('ProductId: ' . $product->getId(), __CLASS__, __FUNCTION__);
}
$lastPurchase = self::_getLastPurchase($product);
if ($lastPurchase instanceof ProductQtyLog) {
self::_recordProductAgeingLog($lastPurchase);
}
}
$end = new UDate();
self::_logMsg("== FINISHED: process product ageing, (productCount: " . $productCount . ", ProductAgeingLogCount: " . ProductAgeingLog::countByCriteria('active = 1') . ")", __CLASS__, __FUNCTION__);
Dao::commitTransaction();
} catch (Exception $e) {
Dao::rollbackTransaction();
echo "\n" . $e->getMessage() . "\n" . $e->getTraceAsString();
}
}
开发者ID:larryu,项目名称:magento-b2b,代码行数:29,代码来源:ProductAgeingReport.php
示例14: getOutput
protected function getOutput()
{
$id = $this->getArg('id', 0, true);
if (!in_array($this->getContext(), ['module', 'action']) || !is_numeric($id) || $id < 1 || $id > 20) {
return false;
}
$value = $this->getContextData()->getValue('value' . $id);
if ($this->hasArg('isset') && $this->getArg('isset')) {
return $value ? 'true' : 'false';
}
if ($this->hasArg('widget') && $this->getArg('widget')) {
if (!$this->environmentIs(self::ENV_INPUT)) {
return false;
}
$select = new rex_category_select();
if ($this->hasArg('multiple') && $this->getArg('multiple')) {
$select->setName('REX_INPUT_VALUE[' . $id . '][]');
$select->setMultiple();
$select->setSelected(rex_var::toArray($value));
} else {
$select->setName('REX_INPUT_VALUE[' . $id . ']');
$select->setSelected($value);
}
if ($this->hasArg('root') && $this->getArg('root')) {
$select->setRootId(explode(',', $this->getArg('root')));
}
$widget = '<div class="rex-select-style">' . $select->get() . '</div>';
if ($this->hasArg('output') && $this->getArg('output')) {
$label = $this->hasArg('label') ? $this->getArg('label') : '';
$widget = Dao::getForm($widget, $label, $this->getArg('output'));
}
return self::quote($widget);
}
return self::quote(htmlspecialchars($value));
}
开发者ID:tbaddade,项目名称:redaxo_dao_var,代码行数:35,代码来源:var_dao_category_select.php
示例15: getAccountByAccountId
/**
* 根据 accountId 来查找账号信息
* @param integer $accountId
* @return array
*/
public function getAccountByAccountId($accountId)
{
if (!$accountId) {
return array();
}
return Dao::factory('Account')->getAccountByAccountId($accountId);
}
开发者ID:panchao1,项目名称:cronsystem,代码行数:12,代码来源:Account.php
示例16: sendEmail
/**
* Sending the email out
*
* @param unknown $sender
* @param unknown $param
*
* @throws Exception
*/
public function sendEmail($sender, $param)
{
$results = $errors = array();
try {
Dao::beginTransaction();
if (!isset($param->CallbackParameter->orderId) || !($order = Order::get($param->CallbackParameter->orderId)) instanceof Order) {
throw new Exception('System Error: invalid order provided!');
}
if (!isset($param->CallbackParameter->emailAddress) || ($emailAddress = trim($param->CallbackParameter->emailAddress)) === '') {
throw new Exception('System Error: invalid emaill address provided!');
}
$emailBody = '';
if (isset($param->CallbackParameter->emailBody) && ($emailBody = trim($param->CallbackParameter->emailBody)) !== '') {
$emailBody = str_replace("\n", "<br />", $emailBody);
}
$pdfFile = EntityToPDF::getPDF($order);
$asset = Asset::registerAsset($order->getOrderNo() . '.pdf', file_get_contents($pdfFile), Asset::TYPE_TMP);
$type = $order->getType();
EmailSender::addEmail('[email protected]', $emailAddress, 'BudgetPC ' . $type . ':' . $order->getOrderNo(), (trim($emailBody) === '' ? '' : $emailBody . "<br /><br />") . 'Please find attached ' . $type . ' (' . $order->getOrderNo() . '.pdf) from Budget PC Pty Ltd.', array($asset));
$order->addComment('An email sent to "' . $emailAddress . '" with the attachment: ' . $asset->getAssetId(), Comments::TYPE_SYSTEM);
$results['item'] = $order->getJson();
Dao::commitTransaction();
} catch (Exception $ex) {
Dao::rollbackTransaction();
$errors[] = $ex->getMessage();
}
$param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
}
开发者ID:larryu,项目名称:magento-b2b,代码行数:36,代码来源:OrderBtns.php
示例17: addComments
/**
*
* @param unknown $sender
* @param unknown $params
*/
public function addComments($sender, $params)
{
$results = $errors = array();
try {
Dao::beginTransaction();
if (!isset($params->CallbackParameter->entityName) || ($entityName = trim($params->CallbackParameter->entityName)) === '') {
throw new Exception('System Error: EntityName is not provided!');
}
if (!isset($params->CallbackParameter->entityId) || ($entityId = trim($params->CallbackParameter->entityId)) === '') {
throw new Exception('System Error: entityId is not provided!');
}
if (!($entity = $entityName::get($entityId)) instanceof $entityName) {
throw new Exception('System Error: no such a entity exisits!');
}
if (!isset($params->CallbackParameter->comments) || ($comments = trim($params->CallbackParameter->comments)) === '') {
throw new Exception('System Error: invalid comments passed in!');
}
$comment = Comments::addComments($entity, $comments, Comments::TYPE_NORMAL);
$results['item'] = $comment->getJson();
Dao::commitTransaction();
} catch (Exception $ex) {
Dao::rollbackTransaction();
$errors[] = $ex->getMessage();
}
$params->ResponseData = StringUtilsAbstract::getJson($results, $errors);
}
开发者ID:larryu,项目名称:magento-b2b,代码行数:31,代码来源:CommentsDiv.php
示例18: saveItem
/**
* (non-PHPdoc)
* @see DetailsPageAbstract::saveItem()
*/
public function saveItem($sender, $param)
{
$results = $errors = array();
try {
Dao::beginTransaction();
if (!isset($param->CallbackParameter->id)) {
throw new Exception('Invalid supplier ID passed in!');
}
$supplier = ($id = trim($param->CallbackParameter->id)) === '' ? new Supplier() : Supplier::get($id);
if (!$supplier instanceof Supplier) {
throw new Exception('Invalid supplier passed in!');
}
$contactName = trim($param->CallbackParameter->address->contactName);
$contactNo = trim($param->CallbackParameter->address->contactNo);
$street = trim($param->CallbackParameter->address->street);
$city = trim($param->CallbackParameter->address->city);
$region = trim($param->CallbackParameter->address->region);
$postCode = trim($param->CallbackParameter->address->postCode);
$country = trim($param->CallbackParameter->address->country);
$address = $supplier->getAddress();
$supplier->setName(trim($param->CallbackParameter->name))->setDescription(trim($param->CallbackParameter->description))->setContactNo(trim($param->CallbackParameter->contactNo))->setEmail(trim($param->CallbackParameter->email))->setAddress(Address::create($street, $city, $region, $country, $postCode, $contactName, $contactNo, $address))->save();
$results['url'] = '/supplier/' . $supplier->getId() . '.html' . (isset($_REQUEST['blanklayout']) ? '?blanklayout=' . $_REQUEST['blanklayout'] : '');
$results['item'] = $supplier->getJson();
Dao::commitTransaction();
} catch (Exception $ex) {
Dao::rollbackTransaction();
$errors[] = $ex->getMessage() . $ex->getTraceAsString();
}
$param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
}
开发者ID:larryu,项目名称:magento-b2b,代码行数:34,代码来源:DetailsController.php
示例19: initialize
public function initialize()
{
if (!$this->isInitialized() && !$this->initializing) {
$this->initializing = true;
$this->dao->setCache($this->owner);
$table = $this->field->getTable();
$id = $table->getPropertyValue($this->owner, $table->getPrimaryKeyField());
$this->collection = array();
ProxyUtils::swap($this->owner, $this->collection, $this->field, $this->dao);
$this->dao->__refreshByFK($this->collection, $id, $this->field->getForeignKeyConstraint());
$cacheCopy = $this->getArrayCopy();
ProxyUtils::swap($this->owner->{Dao::CACHE}, $cacheCopy, $this->field, $this->dao);
$this->initialized = true;
$this->initializing = false;
}
}
开发者ID:netbrain,项目名称:simphple-orm,代码行数:16,代码来源:CollectionProxy.php
示例20: affiche
function affiche()
{
/* Si GET["ajout"] est possitionne, on affiche la vue pour ajouter/modifier une liste*/
if (isset($_GET["ajoutListe"])) {
$this->vue->ajoutListe();
/* Sinon si la date et un groupe est possitionne on affiche la feuille d'absence associe*/
} else {
if (isset($_POST["groupe"])) {
/*On explose pour recuperer le groupe et la promo*/
if (strpos($_POST["groupe"], ':') !== FALSE) {
$groupe = explode(":", $_POST["groupe"])[1];
$promo = explode(":", $_POST["groupe"])[0];
} else {
$groupe = "";
$promo = $_POST["groupe"];
}
} else {
/*On explose pour recuperer le groupe et la promo*/
if (strpos($_GET["ics"], ':') !== FALSE) {
$groupe = explode(":", $_GET["ics"])[1];
$promo = explode(":", $_GET["ics"])[0];
} else {
$groupe = "";
$promo = $_GET["ics"];
}
}
}
/* Si le groupe est NULL, c'est une promo, on utilise la vue associe. Sinon on redirige vers l'ajout de liste.*/
if ($groupe == NULL) {
$dao = new Dao();
$dao->setICS($promo);
$dao->getCours();
// $groupes = $dao->getGroupes2();
if ($this->dao->fichierPromoExist($promo)) {
$groupes = $dao->getGroupeXLS($dao->getFeuilleAbsGroupe($promo));
$this->vue->head();
$this->vue->tableauPromo($promo, $groupes);
} else {
header('location:index.php?ajoutListe=true');
}
} else {
$this->vue->head();
$this->vue->tableau();
}
}
开发者ID:supernoono,项目名称:EDT-IUT,代码行数:45,代码来源:controleur_absence.php
注:本文中的Dao类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论