Room::create

  1. Bitrix24 API (v. 23.675.0)
  2. calendar
  3. Room
  4. create
  • Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/rooms/room.php
  • Класс: BitrixCalendarRoomsRoom
  • Вызов: Room::create
public function create(): Room
{
	$section = SectionTable::add([
		'CAL_TYPE' => $this->type,
		'NAME' => Emoji::encode($this->name),
		'COLOR' => $this->color,
		'OWNER_ID' => $this->ownerId,
		'SORT' => 100,
		'CREATED_BY' => $this->createdBy,
		'DATE_CREATE' => new DateTime(),
		'TIMESTAMP_X' => new DateTime(),
		'ACTIVE' => 'Y',
	]);
	if (!$section->isSuccess())
	{
		$this->addError(Loc::getMessage('EC_ROOM_SAVE_ERROR'));

		return $this;
	}
	$this->setId($section->getId());

	$location = LocationTable::add(
		[
			'SECTION_ID' => $this->id,
			'NECESSITY' => $this->necessity,
			'CAPACITY' => $this->capacity,
			'CATEGORY_ID' => $this->categoryId,
		]
	);
	if (!$location->isSuccess())
	{
		SectionTable::delete($this->id);
		$this->addError(new Error(Loc::getMessage('EC_ROOM_SAVE_ERROR')));

		return $this;
	}

	return $this;
}

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