當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Dao類代碼示例

本文整理匯總了PHP中Dao的典型用法代碼示例。如果您正苦於以下問題:PHP Dao類的具體用法?PHP Dao怎麽用?PHP Dao使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Dao類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Dao類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。