• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/v2/Image/ImageCollection.php
  • Класс: BitrixCatalogv2ImageImageCollection
  • Вызов: ImageCollection::removeOldValues
private function removeOldValues(array $values): void
{
	$valuesToSave = [];

	foreach ($this->prepareValues($values) as $value)
	{
		if (!empty($value) && is_numeric($value))
		{
			$valuesToSave[] = (int)$value;
		}
	}

	foreach ($this->getIterator() as $entity)
	{
		if ($entity->isNew() || !in_array($entity->getId(), $valuesToSave, true))
		{
			$entity->remove();
		}
	}
}