RemindCollection::deDuplicate

  1. Bitrix24 API (v. 23.675.0)
  2. calendar
  3. RemindCollection
  4. deDuplicate
  • Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/core/event/properties/remindcollection.php
  • Класс: BitrixCalendarCoreEventPropertiesRemindCollection
  • Вызов: RemindCollection::deDuplicate
public function deDuplicate(): self
{
	if (!$this->start)
	{
		throw new PropertyException('You should set start event time. Use setEventStart.');
	}
	/** @var Remind[] $remindList */
	$remindList = [];

	/** @var Remind $remind */
	foreach ($this->collection as $remind)
	{
		$key = $remind
			->setEventStart($this->start)
			->getSpecificTime()
			->format('U');

		if (empty($remindList[$key]))
		{
			$remindList[$key] = $remind;
		}
		else
		{
			$remindList[$key] = $this->chooseRemindByRank($remind, $remindList[$key]);
		}
	}

	$this->collection = array_values($remindList);

	return $this;
}

Добавить комментарий