• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/rest/service/baseobject.php
  • Класс: Bitrix\Disk\Rest\Service\BaseObject
  • Вызов: BaseObject::moveTo
protected function moveTo($id, $targetFolderId)
{
	$object = $this->getWorkObjectById($id);
	$targetFolder = $this->getFolderById($targetFolderId);

	if($object->getStorageId() != $targetFolder->getStorageId())
	{
		$this->errorCollection->addOne(new Disk\Internals\Error\Error('Could not move object to another storage'));
		return false;
	}

	$securityContext = $object->getStorage()->getCurrentUserSecurityContext();
	if(!$object->canMove($securityContext, $targetFolder))
	{
		throw new AccessException;
	}
	if(!$object->getParentId())
	{
		throw new RestException('Could not move root folder.');
	}
	if(!$object->moveTo($targetFolder, $this->userId))
	{
		$this->errorCollection->add($object->getErrors());
		return null;
	}

	return $object;
}