Метод refusalOf

private static

Сигнатура метода

private static function refusalOf(Result $result, EntityType $entityType): RestException

Возвращает: RestException

Описание

What REST answers to a refused scenario of the group. The refusals the group names itself are the ones a client can act on, and they are a closed set - {@see OwnerAddressError}. Each of them is a validation refusal of the request, in the words of this layer rather than of the domain, naming the field the client has to look at: | Code of the domain | Field | |---|---| | `ADDRESS_TYPE_OCCUPIED` | `typeId` | | `ADDRESS_TYPE_UNKNOWN` | `typeId` | | `ADDRESS_IS_EMPTY` | `fields` | | `ADDRESS_COUNTRY_CODE_MISMATCH` | `countryCode` | | `ADDRESS_ONLY_REQUISITE_NOT_CREATED` | the owner of the route | The messages are rewritten because the domain writes its errors for a developer reading a log ("The requisite already holds an address of this type."). Anything else is not a refusal of the group at all: the requisites of CRM and the ORM underneath them report their own failures through the same result, and no client can fix a storage that did not store. Such an answer is the system error of REST v3 - it is journalled with the text of the domain and answers the client without it, the way every unexpected failure of REST v3 is answered. One foreign error makes the whole answer a system error, and a refusal of the group standing next to it is not reported: an answer either names refusals only or names none. That is decided rather than left out - a result that carries both is a result nobody understands, and telling the client to fix a field while the portal is failing underneath is worse than saying it failed. No scenario builds such a result today, each of them answers with one error at a time. An owner or an address the user may not have never gets here - the scenario leaves through {@see ObjectNotFoundException} for it, and every action answers that as an absent object.

Параметры

2
Имя Тип По умолчанию Флаги
$result Result —
—
$entityType EntityType —
—

Расположение

Исходный файл метода в Bitrix Framework

Путь к исходному файлу Source
~/bitrix/modulescrm/lib/V2/Infrastructure/Rest/CustomController/Address/Address.php
Расположение метода в файле
Строки 342–357

Исходный код

PHP