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


PHP Attachment::persist方法代碼示例

本文整理匯總了PHP中Attachment::persist方法的典型用法代碼示例。如果您正苦於以下問題:PHP Attachment::persist方法的具體用法?PHP Attachment::persist怎麽用?PHP Attachment::persist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Attachment的用法示例。


在下文中一共展示了Attachment::persist方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: processAddAttachmentsAction

 public function processAddAttachmentsAction()
 {
     $fileData = file_get_contents($_FILES["uploadFile"]["tmp_name"]);
     $attachment = new Attachment();
     $attachment->name = $_FILES['uploadFile']['name'];
     $attachment->attachmentReferenceId = preg_replace('[^a-zA-Z0-9-]', '//', $this->_getParam('attachmentReferenceId'));
     $attachment->mimeType = $_FILES['uploadFile']['type'];
     $attachment->md5sum = md5($fileData);
     $attachment->dateTime = date('Y-m-d H:i:s');
     $attachment->persist();
     $attachmentBlobArray = array();
     $attachmentBlobArray['attachmentId'] = $attachment->attachmentId;
     $attachmentBlobArray['data'] = $fileData;
     $db = Zend_Registry::get('dbAdapter');
     $db->insert('attachmentBlobs', $attachmentBlobArray);
     $acj = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $acj->suppressExit = true;
     $jsonData = $acj->direct(array("attachmentId" => $attachment->attachmentId), false);
     $this->getResponse()->setHeader('Content-Type', 'text/html');
     $this->view->result = $jsonData;
     $this->render();
 }
開發者ID:dragonlet,項目名稱:clearhealth,代碼行數:22,代碼來源:AttachmentsController.php

示例2: processAttachToNotesAction

 public function processAttachToNotesAction()
 {
     $attachmentId = (int) $this->_getParam('attachmentId');
     $attachmentReferenceId = $this->_getParam('attachmentReferenceId');
     $attachment = new Attachment();
     $attachment->attachmentId = $attachmentId;
     $attachment->populate();
     $attachment->attachmentReferenceId = $attachmentReferenceId;
     $attachment->persist();
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(true);
 }
開發者ID:dragonlet,項目名稱:clearhealth,代碼行數:13,代碼來源:MessagingController.php

示例3: flashUploadAction

 function flashUploadAction()
 {
     $attachmentReferenceId = (int) $this->_getParam('attachmentReferenceId');
     $fileData = base64_decode($this->_getParam('fileUpload'));
     $attachment = new Attachment();
     if (!isset($_FILES['uploadFile']['name'])) {
         $attachment->name = date('Y-m-d');
     } else {
         $attachment->name = $_FILES['uploadFile']['name'];
     }
     $attachment->attachmentReferenceId = $attachmentReferenceId;
     $attachment->mimeType = 'image/jpeg';
     $attachment->md5sum = md5($fileData);
     $attachment->dateTime = date('Y-m-d H:i:s');
     $attachment->persist();
     $attachmentBlobArray = array();
     $attachmentBlobArray['attachmentId'] = $attachment->attachmentId;
     $attachmentBlobArray['data'] = $fileData;
     $db = Zend_Registry::get('dbAdapter');
     $db->insert('attachmentBlobs', $attachmentBlobArray);
     $person = new Person();
     $person->personId = $attachmentReferenceId;
     $person->populate();
     $person->activePhoto = (int) $attachment->attachmentId;
     $person->persist();
     Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender();
     return;
 }
開發者ID:dragonlet,項目名稱:clearhealth,代碼行數:28,代碼來源:PatientPicturesController.php


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