• Модуль: crmmobile
  • Путь к файлу: ~/bitrix/modules/crmmobile/lib/Controller/Category.php
  • Класс: BitrixCrmMobileControllerCategory
  • Вызов: Category::deleteAction
public function deleteAction(Factory $factory, int $categoryId): void
{
	$category = $factory->getCategory($categoryId);
	if (!$category)
	{
		$this->addError(ErrorCode::getNotFoundError());
		return;
	}

	if (!Container::getInstance()->getUserPermissions()->canDeleteCategory($category))
	{
		$this->addError(ErrorCode::getAccessDeniedError());
		return;
	}

	$result = $category->delete();
	if (!$result->isSuccess())
	{
		$this->addErrors($result->getErrors());
	}
}