本文整理汇总了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();
}
示例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);
}
示例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;
}