• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/uf/connector.php
  • Класс: BitrixDiskUfConnector
  • Вызов: Connector::buildFromAttachedObject
static function buildFromAttachedObject(AttachedObject $attachedObject)
{
	if(!Loader::includeModule($attachedObject->getModuleId()))
	{
		throw new SystemException("Could not include module {$attachedObject->getModuleId()}");
	}
	$className = str_replace('\\', '\', $attachedObject->getEntityType());
	if (!is_subclass_of($className, Connector::class))
	{
		throw new SystemException('Invalid class for Connector. Must be instance of Connector');
	}

	/** @var BitrixDiskUfConnector $connector */
	$connector = new $className($attachedObject->getEntityId());

	if(!$connector instanceof Connector)
	{
		throw new SystemException('Invalid class for Connector. Must be instance of Connector');
	}

	if($connector instanceof IWorkWithAttachedObject)
	{
		$connector->setAttachedObject($attachedObject);
	}

	return $connector;
}