当前位置: 首页>>代码示例>>PHP>>正文


PHP InputDocument::getValidationFailures方法代码示例

本文整理汇总了PHP中InputDocument::getValidationFailures方法的典型用法代码示例。如果您正苦于以下问题:PHP InputDocument::getValidationFailures方法的具体用法?PHP InputDocument::getValidationFailures怎么用?PHP InputDocument::getValidationFailures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InputDocument的用法示例。


在下文中一共展示了InputDocument::getValidationFailures方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Create the application document registry
  * @param array $aData
  * @return string
  **/
 public function create($aData)
 {
     $oConnection = Propel::getConnection(InputDocumentPeer::DATABASE_NAME);
     try {
         if (isset($aData['INP_DOC_UID']) && $aData['INP_DOC_UID'] == '') {
             unset($aData['INP_DOC_UID']);
         }
         if (!isset($aData['INP_DOC_UID'])) {
             $aData['INP_DOC_UID'] = G::generateUniqueID();
         }
         $oInputDocument = new InputDocument();
         $oInputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         if ($oInputDocument->validate()) {
             $oConnection->begin();
             if (isset($aData['INP_DOC_TITLE'])) {
                 $oInputDocument->setInpDocTitle($aData['INP_DOC_TITLE']);
             }
             if (isset($aData['INP_DOC_DESCRIPTION'])) {
                 $oInputDocument->setInpDocDescription($aData['INP_DOC_DESCRIPTION']);
             }
             $iResult = $oInputDocument->save();
             $oConnection->commit();
             return $aData['INP_DOC_UID'];
         } else {
             $sMessage = '';
             $aValidationFailures = $oInputDocument->getValidationFailures();
             foreach ($aValidationFailures as $oValidationFailure) {
                 $sMessage .= $oValidationFailure->getMessage() . '<br />';
             }
             throw new Exception('The registry cannot be created!<br />' . $sMessage);
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
开发者ID:nshong,项目名称:processmaker,代码行数:41,代码来源:InputDocument.php

示例2: create

 /**
  * Create the application document registry
  *
  * @param array $aData
  * @return string
  *
  */
 public function create($aData)
 {
     $oConnection = Propel::getConnection(InputDocumentPeer::DATABASE_NAME);
     try {
         if (isset($aData['INP_DOC_UID']) && $aData['INP_DOC_UID'] == '') {
             unset($aData['INP_DOC_UID']);
         }
         if (!isset($aData['INP_DOC_UID'])) {
             $aData['INP_DOC_UID'] = G::generateUniqueID();
         }
         $oInputDocument = new InputDocument();
         $oInputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         if ($oInputDocument->validate()) {
             $oConnection->begin();
             if (isset($aData['INP_DOC_TITLE'])) {
                 $oInputDocument->setInpDocTitle($aData['INP_DOC_TITLE']);
             }
             if (isset($aData['INP_DOC_DESCRIPTION'])) {
                 $oInputDocument->setInpDocDescription($aData['INP_DOC_DESCRIPTION']);
             }
             $iResult = $oInputDocument->save();
             $oConnection->commit();
             //Add Audit Log
             switch ($aData['INP_DOC_FORM_NEEDED']) {
                 case 'VIRTUAL':
                     $docType = 'Digital';
                     break;
                 case 'REAL':
                     $docType = 'Printed';
                     break;
                 case 'VREAL':
                     $docType = 'Digital/Printed';
                     break;
             }
             if (isset($aData['INP_DOC_VERSIONING']) && $aData['INP_DOC_VERSIONING'] == 1) {
                 $enableVersion = 'Yes';
             } else {
                 $enableVersion = 'No';
             }
             $description = "Input Document Title: " . $aData['INP_DOC_TITLE'] . ", Input Document Uid: " . $aData['INP_DOC_UID'] . ", Document Type: " . $docType;
             if (!empty($aData['INP_DOC_DESCRIPTION'])) {
                 $description .= ", Description: " . $aData['INP_DOC_DESCRIPTION'];
             }
             if (!empty($aData['INP_DOC_DESTINATION_PATH'])) {
                 $description .= ", Destination Path: " . $aData['INP_DOC_DESTINATION_PATH'];
             }
             $inputDocMaxFileSize = "";
             if (!empty($aData['INP_DOC_MAX_FILESIZE'])) {
                 $inputDocMaxFileSize = $aData['INP_DOC_MAX_FILESIZE'] ? $aData['INP_DOC_MAX_FILESIZE'] . ' ' . $aData['INP_DOC_MAX_FILESIZE_UNIT'] : "256 MB";
                 $inputDocMaxFileSize = ", Maximum Input Document file size: " . $inputDocMaxFileSize;
             }
             if (!empty($aData['INP_DOC_MAX_FILESIZE'])) {
                 $description .= ", Extensions: " . $aData['INP_DOC_TYPE_FILE'];
             }
             $description .= $inputDocMaxFileSize;
             G::auditLog("CreateInputDocument", $description);
             return $aData['INP_DOC_UID'];
         } else {
             $sMessage = '';
             $aValidationFailures = $oInputDocument->getValidationFailures();
             foreach ($aValidationFailures as $oValidationFailure) {
                 $sMessage .= $oValidationFailure->getMessage() . '<br />';
             }
             throw new Exception('The registry cannot be created!<br />' . $sMessage);
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:77,代码来源:InputDocument.php


注:本文中的InputDocument::getValidationFailures方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。