当前位置: 首页>>代码示例>>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;未经允许,请勿转载。