@uses LeftAndMainExtension->augmentNewSiteTreeItem()

@param int|string $id
@param bool $setID
@return mixed|DataObject
@throws HTTPResponse_Exception
349591
public function getNewItem($id, $setID = true)
    {
        $parentClass = $this->config()->get('tree_class');
        list(, $className, $parentID) = array_pad(explode('-', $id), 3, null);

        if (!is_a($className, $parentClass, true)) {
            $response = Security::permissionFailure($this);
            if (!$response) {
                $response = $this->getResponse();
            }
            throw new HTTPResponse_Exception($response);
        }

        /** @var SiteTree $newItem */
        $newItem = Injector::inst()->create($className);
        $newItem->Title = _t(
            __CLASS__ . '.NEWPAGE',
            "New {pagetype}",
            'followed by a page type title',
            array('pagetype' => singleton($className)->i18n_singular_name())
        );
        $newItem->ClassName = $className;
        $newItem->ParentID = $parentID;

        // DataObject::fieldExists only checks the current class, not the hierarchy
        // This allows the CMS to set the correct sort value
        if ($newItem->castingHelper('Sort')) {
            $maxSort = DB::prepared_query(
                'SELECT MAX("Sort") FROM "SiteTree" WHERE "ParentID" = ?',
                array($parentID)
            )->value();
            $newItem->Sort = (int)$maxSort + 1;
        }

        if ($setID && $id) {
            $newItem->ID = $id;
        }

        # Some modules like subsites add extra fields that need to be set when the new item is created
        $this->extend('augmentNewSiteTreeItem', $newItem);

        return $newItem;
    }
345755
public function findByID($id, bool $failable = false)
    {
        $query = $this->newQuery();
        if($this->soft_deletes == true) {
            $query->withTrashed();
        }

        return ($failable == true)
            ? $query->findOrFail($id) : $query->find($id);
    }
654629
public function setOpenedItem($id = null)
    {
        $openedItem = $id === null ? $this->getCurrentItemId() : (int) $id;
        $this->openedItems[$openedItem] = $openedItem;
        return $this;
    }
259195
public function setId($id = null) {

        if (
            $id === null ||
            is_bool($id) ||
            ( is_int($id) && $id > 0 ) ||
            ( is_string($id) && !empty($id) )
        ) {

            $this->id = $id;

        } else {

            throw new InvalidArgumentException("Invalid RPC id");

        }

        return $this;

    }
249546
public function findOne($id)
    {
        return ($itemArray = $this->getItemDataProvider($id)) ? $this->createItem($itemArray) : false;
    }
983463
public function setId($id)
    {
        if ($this->hasData(self::P_ID)) {
            throw new JobException('Cant set id cause it is already sets!');
        }

        return $this->setData(self::P_ID, $id);
    }
942177
public function setId(int $id): Folder
    {
        Assert::greaterThan($id, 0);

        $this->id = $id;

        return $this;
    }
419488
public function setAttributeSetFilter($setId)
    {
        if (is_array($setId)) {
            if (!empty($setId)) {
                $this->join(
                    ['entity_attribute' => $this->getTable('eav_entity_attribute')],
                    'entity_attribute.attribute_id = main_table.attribute_id',
                    []
                );
                $this->addFieldToFilter('entity_attribute.attribute_set_id', ['in' => $setId]);
                $this->addAttributeGrouping();
            }
        } elseif ($setId) {
            $this->join(
                ['entity_attribute' => $this->getTable('eav_entity_attribute')],
                'entity_attribute.attribute_id = main_table.attribute_id',
                []
            );
            $this->addFieldToFilter('entity_attribute.attribute_set_id', $setId);
        }

        return $this;
    }
1157813
public function fetch( $id ) {

		if ( $this->contains( $id ) ) {
			$this->cacheHits++;
			return $this->cache->getItem( $id );
		}

		$this->cacheMisses++;
		return false;
	}
7311
protected function setResourceId($id)
    {
        $path = Config::get('nova.path');
        // If the path is the site route, prevent a double-slash
        if ('/' === $path) {
            $path = '';
        }
        return $this->withMeta(['id' => $id, 'nova_path' => $path]);
    }
1151119
public function getNodeData($id)
    {
        if (!isset($this->getMenu()[$id])) {
            return false;
        }
        
        return $this->getMenu()[$id];
    }
1276723
public function setId($id)
    {
        $this->id = (integer)$id;
        $this->hasId = true;

        return $this;
    }
131964
public function get($id) {
		if (!isset($id)) throw new \Exception('ID for job is missing.');
		$id_file = $this->_save_path . $id;
		if (!is_file($id_file)) throw new \Exception('Job file for ID is missing.');

		// get the requested ID
		$item = json_decode(file_get_contents($id_file), true);

		return $item;
	}
1237798
public static function findById($id, $throwException = true)
    {
        $e = $throwException ? new ServerErrorHttpException("Property with id $id not found") : false;

        return static::loadModel(
            $id,
            false,
            true,
            86400,
            $e,
            true
        );
    }
548935
public function getTotalItems($id = null)
    {
        $hash = md5($id);
        return isset($this->totalItems[$hash]) ? $this->totalItems[$hash] : 0;
    }
853523
public function getUpdateRequest($id, $updateBind)
    {
        return new StorageDataRequest(
            [$this->sourceDataAdapter, $this->cacheDataAdapter, $id, $updateBind],
            function (DataAdapterInterface $sourceData, DataAdapterInterface $cacheData, $id, $updateBind) {
                $request = $sourceData->getUpdateRequest($id, $updateBind);
                $request->send();
                $result = $request->fetch();
                if ($result) {
                    $cacheData->getDeleteRequest($id)->send();
                }
            
                return $result;
            }
        );
    }
382492
public function get_item($id)
	{
		// Element empty!
		if (count($this->_items) === 0)
			return FALSE;

		if (array_key_exists($id, $this->_items))
		{ // By ID
			return $this->_items[$id];
		} else
		{ // By route
			$path = $this->get_tree_index(Route::get($id));

			if($path != false)
			{
				$levels = count($path);

				$item = $this->_items[$path[0]];

				if($levels > 1)
				{
					for($i=1; $i<$levels; $i++)
					{
						$item = $item->siblings[$path[$i]];
					}
				}
				return $item;
			}
		}
		return FALSE;
	}