<?php
// CBPWorkflowTemplateLoader :: getTemplateConstants()
// /dist/bitrix/modules/bizproc/classes/general/workflowtemplateloader.php:596
public static function getTemplateConstants($workflowTemplateId)
{
$workflowTemplateId = (int) $workflowTemplateId;
if ($workflowTemplateId <= 0)
throw new CBPArgumentOutOfRangeException("workflowTemplateId", $workflowTemplateId);
if (!isset(self::$workflowConstants[$workflowTemplateId]))
{
$cache = \Bitrix\Main\Application::getInstance()->getManagedCache();
$cacheTag = self::CONSTANTS_CACHE_TAG_PREFIX.$workflowTemplateId;
if ($cache->read(3600*24*7, $cacheTag))
{
self::$workflowConstants[$workflowTemplateId] = (array) $cache->get($cacheTag);
}
else
{
$iterator = self::GetList(
array(),
array('ID' => $workflowTemplateId),
false,
false,
array('CONSTANTS')
);
if ($row = $iterator->fetch())
{
self::$workflowConstants[$workflowTemplateId] = (array) $row['CONSTANTS'];
$cache->set($cacheTag, self::$workflowConstants[$workflowTemplateId]);
}
else
self::$workflowConstants[$workflowTemplateId] = array();
}
}
return self::$workflowConstants[$workflowTemplateId];
}