• Модуль: location
  • Путь к файлу: ~/bitrix/modules/location/lib/repository/location/database.php
  • Класс: BitrixLocationRepositoryLocationDatabase
  • Вызов: Database::delete
public function delete(Location $location): Result
{
	$id = $location->getId();

	if($id <= 0)
	{
		return new Result();
	}

	$res = $this->addressTable::getList([
		'filter' => ['LOCATION_ID' => (int)$id]
	]);

	if($row = $res->fetch())
	{
		return (new Result())
			->addError(
				new Error(
					Loc::getMessage('LOCATION_REPO_DB_EXIST_LINKED_ADDRESS')
				)
			);
	}

	$result = $this->locationTable::delete($id);

	if($result->isSuccess())
	{
		$this->locationNameTable::deleteByLocationId($id);
		$this->hierarchyTable::deleteByLocationId($id);
		$this->fieldTable::deleteByLocationId($id);
	}

	return $result;
}