Метод delete

public

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

public function delete(int $userId, int $formId, ?DateTime $expectedModifiedTime = null, bool $confirmed = false): void

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

Описание

Deletes a CRM form together with the data the legacy cascade removes. The cascade is reproduced literally by FormDeleteRepository: the agreements, the responsible queue, the dependency groups, the rotation option, the background image and the built script package stay behind as orphans, exactly as they do today. What is new is that the three reasons of a refusal are told apart instead of sharing one false. The plan of the portal is asked here as it is asked on a creation and on a change: legacy checks it in the access predicate every changing action of the editor goes through, removal included, so leaving it out would remove a form on a plan where the editor refuses to. The confirmed phone number is not asked: no path of the legacy removal asks for it. Both guards of the removal stand before the first destroying step, because the cascade is irreversible and a half-run one is not rolled back. Their own order follows the same rule: the expected version is the picture the whole request was formed against, so a form changed since is refused before anything is decided out of that stale picture - a client that learns about the working form first would ask its user to confirm a removal it has yet to be told to reread. A form that may not be removed at all is refused ahead of both: being a system form is a property of the form rather than an answer to what the request carries. Answered on the read alone the guards would say nothing about the row the cascade then runs on, so the removal is claimed before it: the same conditions travel as conditions of one statement over the row ({@see FormWriteRepository::claimForRemoval()}), and a form changed or turned on in between is not claimed and loses nothing. The read keeps its own guards - they answer the everyday refusals without spending a statement on a form the caller may not remove at all. Neither guard is demanded of a client that carries nothing: a request without the expected version removes the form without comparing versions, and a form that does not work is removed unconfirmed the way it always was.

Параметры

4
Имя Тип По умолчанию Флаги
$userId int —
—
$formId int —
—
$expectedModifiedTime ?DateTime null
—
$confirmed bool false
—

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

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

Путь к исходному файлу Source
~/bitrix/modulescrm/lib/V2/Internal/Service/WebForm/FormWriter.php
Расположение метода в файле
Строки 307–341

Исходный код

PHP