• Модуль: ui
  • Путь к файлу: ~/bitrix/modules/ui/lib/Integration/Rest/MaskImportApp.php
  • Класс: BitrixUIIntegrationRestMaskImportApp
  • Вызов: MaskImportApp::init
public function init($event): void
{
	$this->ownerId = (int) $event->getParameter('APP_ID');
	if ($this->ownerId <= 0)
	{
		$this->errorCollection->setError(new Error('Application id is not set.'));
		return;
	}

	if (!($app = RestAppTable::getById($this->ownerId)->fetch()))
	{
		$this->errorCollection->setError(new Error('Application is not found.'));
		return;
	}

	$this->owner = new AvatarMaskOwnerRestApp($this->ownerId);

	if ($group = AvatarMaskGroupTable::getList([
		'select' => ['ID'],
		'filter' => [
			'=OWNER_TYPE' => AvatarMaskOwnerRestApp::class,
			'=OWNER_ID' => $this->ownerId,
		]
	])->fetch())
	{
		$this->groupId = $group['ID'];
	}
	else
	{
		$this->groupId = AvatarMaskGroup::createOrGet($this->owner, $app['APP_NAME'])->getId();
	}
}