• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/attribute/entity/fieldattribute.php
  • Класс: Bitrix\Crm\Attribute\Entity\FieldAttributeTable
  • Вызов: FieldAttributeTable::deleteByPhase
static function deleteByPhase($phaseID, $entityTypeID, $entityScope)
{
	if(!is_string($phaseID))
	{
		$phaseID = (string)$phaseID;
	}

	if(!is_int($entityTypeID))
	{
		$entityTypeID = (int)$entityTypeID;
	}

	if(!is_string($entityScope))
	{
		$entityScope = (string)$entityScope;
	}

	$res = self::getList([
		'filter' => [
			'LOGIC' => 'AND',
			[
				'=ENTITY_TYPE_ID' => $entityTypeID,
				'=ENTITY_SCOPE' => $entityScope,
			],
			[
				'LOGIC' => 'OR',
				'=START_PHASE' => $phaseID,
				'=FINISH_PHASE' => $phaseID
			],
		],
		'select' => [
			'ID',
		],
	]);

	while($item = $res->fetch())
	{
		self::delete($item['ID']);
	}
}