• Модуль: report
  • Путь к файлу: ~/bitrix/modules/report/lib/visualconstructor/internal/model.php
  • Класс: BitrixReportVisualConstructorInternalModel
  • Вызов: Model::delete
public function delete()
{
	$ownerId = $this->getId();
	$referenceAttributesMap = static::getMapReferenceAttributes();

	foreach ($referenceAttributesMap as $referenceKey => $referenceAttributes)
	{
		if (!empty($referenceAttributes['options']['deleteSkip']))
		{
			continue;
		}

		if (!$this->{$referenceKey})
		{
			$this->loadAttribute($referenceKey);
		}


		if ($this->{$referenceKey})
		{
			switch ($referenceAttributes['type'])
			{
				case Common::ONE_TO_MANY:
					$this->deleteOneToManyReferences($this->{$referenceKey});
					break;
				case Common::MANY_TO_MANY:
					$this->deleteManyToManyReferences($this->{$referenceKey}, $referenceAttributes, $ownerId);
					break;
				case Common::MANY_TO_ONE:
					$this->deleteManyToOneReference($this->{$referenceKey}, $referenceAttributes, $ownerId);
					break;
				case Common::ONE_TO_ONE:
					//TODO
					break;
			}
		}

	}
	$entityTableClass = static::getTableClassName();
	$deleteEntity = $entityTableClass::delete($ownerId);
	if ($deleteEntity->isSuccess())
	{
		return true;
	}
	else
	{
		$this->errors[] = $deleteEntity->getErrors();
		return null;
	}
}