本文整理汇总了PHP中OutputDocument::fromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputDocument::fromArray方法的具体用法?PHP OutputDocument::fromArray怎么用?PHP OutputDocument::fromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputDocument
的用法示例。
在下文中一共展示了OutputDocument::fromArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Create the application document registry
* @param array $aData
* @return string
* */
public function create($aData)
{
$oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
try {
if (isset($aData['OUT_DOC_UID']) && $aData['OUT_DOC_UID'] == '') {
unset($aData['OUT_DOC_UID']);
}
if (!isset($aData['OUT_DOC_UID'])) {
$aData['OUT_DOC_UID'] = G::generateUniqueID();
}
if (!isset($aData['OUT_DOC_GENERATE'])) {
$aData['OUT_DOC_GENERATE'] = 'BOTH';
} else {
if ($aData['OUT_DOC_GENERATE'] == '') {
$aData['OUT_DOC_GENERATE'] = 'BOTH';
}
}
$oOutputDocument = new OutputDocument();
$oOutputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oOutputDocument->validate()) {
$oConnection->begin();
if (isset($aData['OUT_DOC_TITLE'])) {
$oOutputDocument->setOutDocTitle($aData['OUT_DOC_TITLE']);
}
if (isset($aData['OUT_DOC_DESCRIPTION'])) {
$oOutputDocument->setOutDocDescription($aData['OUT_DOC_DESCRIPTION']);
}
$oOutputDocument->setOutDocFilename($aData['OUT_DOC_FILENAME']);
if (isset($aData['OUT_DOC_TEMPLATE'])) {
$oOutputDocument->setOutDocTemplate($aData['OUT_DOC_TEMPLATE']);
}
$iResult = $oOutputDocument->save();
$oConnection->commit();
return $aData['OUT_DOC_UID'];
} else {
$sMessage = '';
$aValidationFailures = $oOutputDocument->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;
}
}
示例2: create
/**
* Create the application document registry
* @param array $aData
* @return string
* */
public function create($aData)
{
$oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
try {
if (isset($aData['OUT_DOC_UID']) && $aData['OUT_DOC_UID'] == '') {
unset($aData['OUT_DOC_UID']);
}
if (!isset($aData['OUT_DOC_UID'])) {
$aData['OUT_DOC_UID'] = G::generateUniqueID();
}
if (!isset($aData['OUT_DOC_GENERATE'])) {
$aData['OUT_DOC_GENERATE'] = 'BOTH';
} else {
if ($aData['OUT_DOC_GENERATE'] == '') {
$aData['OUT_DOC_GENERATE'] = 'BOTH';
}
}
$oOutputDocument = new OutputDocument();
$oOutputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oOutputDocument->validate()) {
$oConnection->begin();
if (isset($aData['OUT_DOC_TITLE'])) {
$oOutputDocument->setOutDocTitle($aData['OUT_DOC_TITLE']);
}
if (isset($aData['OUT_DOC_DESCRIPTION'])) {
$oOutputDocument->setOutDocDescription($aData['OUT_DOC_DESCRIPTION']);
}
$oOutputDocument->setOutDocFilename($aData['OUT_DOC_FILENAME']);
if (isset($aData['OUT_DOC_TEMPLATE'])) {
$oOutputDocument->setOutDocTemplate($aData['OUT_DOC_TEMPLATE']);
}
$iResult = $oOutputDocument->save();
$oConnection->commit();
//Add Audit Log
$description = "Output Document Name: ".$aData['OUT_DOC_TITLE'].", Output Document Uid: ".$aData['OUT_DOC_UID'].", Filename generated: ".$aData['OUT_DOC_FILENAME'];
if(!empty($aData['OUT_DOC_DESCRIPTION'])){
$description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION'];
}
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'];
}
if(!empty($aData['OUT_DOC_GENERATE'])){
$description .= ", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
}
if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){
$pdfSecurity = 'Disabled';
}else{
$pdfSecurity = 'Enabled';
}
$description .= ", PDF Security: ".$pdfSecurity;
if(!empty($aData['OUT_DOC_VERSIONING'])){
$description .= ", Enable Versioning: Yes";
}
if(!empty($aData['OUT_DOC_DESTINATION_PATH'])){
$description .= ", Destination Path: ".$aData['OUT_DOC_DESTINATION_PATH'];
}
if(!empty($aData['OUT_DOC_TAGS'])){
$description .= ", Tags: ".$aData['OUT_DOC_TAGS'];
}
if(!empty($aData['OUT_DOC_OPEN_TYPE'])){
if($aData['OUT_DOC_OPEN_TYPE']==0){
$genLink = 'Open the file';
}else{
$genLink = 'Download the file';
}
$description .= ", By clicking on the generated file link: ".$genLink;
}
G::auditLog("CreateOutputDocument", $description);
return $aData['OUT_DOC_UID'];
} else {
$sMessage = '';
$aValidationFailures = $oOutputDocument->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);
}
//.........这里部分代码省略.........