- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/internals/project/useroption/useroptioncontroller.php
- Класс: BitrixTasksInternalsProjectUserOptionUserOptionController
- Вызов: UserOptionController::delete
public function delete(int $option): Result
{
$deleteResult = new Result();
if (!$this->isOption($option))
{
$deleteResult->addError(0, 'Wrong option.');
return $deleteResult;
}
$item = ProjectUserOptionTable::getList([
'select' => ['ID'],
'filter' => [
'PROJECT_ID' => $this->projectId,
'USER_ID' => $this->userId,
'OPTION_CODE' => $option,
],
])->fetch();
if ($item)
{
$tableDeleteResult = ProjectUserOptionTable::delete($item);
if (!$tableDeleteResult->isSuccess())
{
$deleteResult->addError(1, 'Deleting from table failed.');
return $deleteResult;
}
$this->onAfterOptionDeleted($option);
}
return $deleteResult;
}