• Модуль: forum
  • Путь к файлу: ~/bitrix/modules/forum/lib/comments/entity.php
  • Класс: BitrixForumCommentsEntity
  • Вызов: Entity::getEntities
static function getEntities()
{
	if (!is_array(self::$entities))
	{
		self::$entities = array(
			"tk" => array(
				"entityType" => "tk",
				"className" => TaskEntity::className(),
				"moduleId" => "tasks",
				"xmlIdPrefix" => TaskEntity::getXmlIdPrefix()),
			"wf" => array(
				"entityType" => "wf",
				"className" => WorkflowEntity::className(),
				"moduleId" => "lists",
				"xmlIdPrefix" => WorkflowEntity::getXmlIdPrefix()),
			"ev" => array(
				"entityType" => "ev",
				"className" => CalendarEntity::className(),
				"moduleId" => "calendar",
				"xmlIdPrefix" => CalendarEntity::getXmlIdPrefix()),
			"tm" => array(
				"entityType" => "tm",
				"className" => Entity::className(),
				"moduleId" => "timeman",
				"xmlIdPrefix" => 'TIMEMAN_ENTRY_'
			),
			"tr" => array(
				"entityType" => "tr",
				"className" => Entity::className(),
				"moduleId" => "timeman",
				"xmlIdPrefix" => 'TIMEMAN_REPORT_'
			),
			"default" => array(
				"entityType" => "default",
				"className" => Entity::className(),
				"moduleId" => "forum",
				"xmlIdPrefix" => Entity::getXmlIdPrefix()
			)
		);

		$event = new Event("forum", "onBuildAdditionalEntitiesList");
		$event->send();

		foreach ($event->getResults() as $evenResult)
		{
			$result = $evenResult->getParameters();
			if (!is_array($result))
			{
				throw new SystemException('Event onBuildAdditionalEntitiesList: result must be an array.');
			}

			foreach ($result as $connector)
			{
				if (empty($connector['ENTITY_TYPE']))
				{
					throw new SystemException('Event onBuildAdditionalEntitiesList: key ENTITY_TYPE is not found.');
				}

				if (empty($connector['MODULE_ID']))
				{
					throw new SystemException('Event onBuildAdditionalEntitiesList: key MODULE_ID is not found.');
				}

				if (empty($connector['CLASS']))
				{
					throw new SystemException('Event onBuildAdditionalEntitiesList: key CLASS is not found.');
				}

				if (is_string($connector['CLASS']) && class_exists($connector['CLASS']))
				{
					self::$entities[mb_strtolower($connector['ENTITY_TYPE'])] = array(
						"id" => mb_strtolower($connector['ENTITY_TYPE']),
						"className" => str_replace('\\', '\', $connector['CLASS']),
						"moduleId" => $connector['MODULE_ID'],
						"xmlIdPrefix" => mb_strtoupper($connector['ENTITY_TYPE'])."_"
					);
				}
			}
		}
	}
	return self::$entities;
}