📝 Attachment : add some @var on object init

This commit is contained in:
Pierre Goiffon
2019-08-05 11:04:26 +02:00
parent d2015b7d7b
commit cbc96d8a58
3 changed files with 5 additions and 1 deletions

View File

@@ -66,6 +66,7 @@ try
try
{
$oDoc = utils::ReadPostedDocument('file');
/** @var Attachment $oAttachment */
$oAttachment = MetaModel::NewObject('Attachment');
$oAttachment->Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime'));
$oAttachment->Set('temp_id', $sTempId);
@@ -73,7 +74,7 @@ try
$oAttachment->SetDefaultOrgId();
$oAttachment->Set('contents', $oDoc);
$iAttId = $oAttachment->DBInsert();
$aResult['msg'] = htmlentities($oDoc->GetFileName(), ENT_QUOTES, 'UTF-8');
$aResult['icon'] = utils::GetAbsoluteUrlAppRoot().AttachmentPlugIn::GetFileIcon($oDoc->GetFileName());
$aResult['att_id'] = $iAttId;

View File

@@ -1145,6 +1145,7 @@ class ObjectController extends BrickController
try
{
$oDocument = utils::ReadPostedDocument($sFieldName);
/** @var \Attachment $oAttachment */
$oAttachment = MetaModel::NewObject('Attachment');
$oAttachment->Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime')); // one hour...
$oAttachment->Set('temp_id', $sTempId);

View File

@@ -2528,6 +2528,7 @@ EOF
{
$aDimensions = null;
$oDoc = InlineImage::ResizeImageToFit($oDoc, $aDimensions);
/** @var Attachment $oAttachment */
$oAttachment = MetaModel::NewObject('InlineImage');
$oAttachment->Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime'));
$oAttachment->Set('temp_id', $sTempId);
@@ -2577,6 +2578,7 @@ EOF
} else {
$aDimensions = null;
$oDoc = InlineImage::ResizeImageToFit($oDoc, $aDimensions);
/** @var Attachment $oAttachment */
$oAttachment = MetaModel::NewObject('InlineImage');
$oAttachment->Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime'));
$oAttachment->Set('temp_id', $sTempId);