• Модуль: vote
  • Путь к файлу: ~/bitrix/modules/vote/lib/attachment/connector.php
  • Класс: BitrixVoteAttachmentConnector
  • Вызов: Connector::buildFromAttachedObject
static function buildFromAttachedObject(BitrixVoteAttach $attachedObject)
{
	if(!Loader::includeModule($attachedObject->getModuleId()))
	{
		throw new SystemException("Module {$attachedObject->getModuleId()} is not included.");
	}
	$className = str_replace('\\', '\', $attachedObject->getEntityType());
	/** @var BitrixVoteAttachmentConnector $connector */
	if (!is_a($className, Connector::class, true))
	{
		throw new ObjectNotFoundException('Connector class should be instance of BitrixVoteAttachmentConnector.');
	}

	$connector = new $className($attachedObject->getEntityId());

	if($connector instanceof Storable)
	{
		$connector->setStorage($attachedObject->getStorage());
	}

	return $connector;
}