Documentation

GetDocument

array
IBPWorkflowDocument::GetDocument(  mixed documentId
);

This method returns properties (fields) of document as an associative array type as follows

array(
property_code => value,
...
)
All properties are defined, which are returned by GetDocumentFields method.

Method parameters

ParameterDescription
documentIdDocument identifier

Examples

<?
public function GetDocument($documentId)
{
$documentId = intval($documentId);
if ($documentId <= 0)
throw new CBPArgumentNullException("documentId");

$arResult = null;

$dbDocumentList = CIBlockElement::GetList(
array(),
array("ID" => $documentId, "SHOW_NEW"=>"Y", "SHOW_HISTORY" => "Y")
);
if ($objDocument = $dbDocumentList->GetNextElement())
{
$arDocumentFields = $objDocument->GetFields();
$arDocumentProperties = $objDocument->GetProperties();

foreach ($arDocumentFields as $fieldKey => $fieldValue)
{
if (substr($fieldKey, 0, 1) != "~")
$arResult[$fieldKey] = $fieldValue;
}

foreach ($arDocumentProperties as $propertyKey => $propertyValue)
$arResult["PROPERTY_".$propertyKey] = $propertyValue["VALUE"];
}

return $arResult;
}
?>


© «Bitrix24», 2001-2024