• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/entity/letter.php
  • Класс: BitrixSenderEntityLetter
  • Вызов: Letter::createInstanceByPostingId
static function createInstanceByPostingId($postingId)
{
	$row = LetterTable::getList(array(
		'select' => array('ID', 'IS_ADS'),
		'filter' => array('=POSTING_ID' => $postingId),
		'limit' => 1
	))->fetch();
	if (!$row)
	{
		return new static();
	}

	if ($row['IS_ADS'] === 'Y')
	{
		return new Ad($row['ID']);
	}
	else
	{
		return new static($row['ID']);
	}
}