Get document by ID

Get document by ID and return a document object instance for the fetch
document.

@param string $id
@return phpillowDocument
354844
public function fetchById( $id )
    {
        // If a fetch is called with an empty ID, we throw an exception, as we
        // would get database statistics otherwise, and the following error may
        // be hard to debug.
        if ( empty( $id ) )
        {
            throw new phpillowResponseNotFoundErrorException( array(
                'error'  => 'not_found',
                'reason' => 'No document ID specified.',
            ) );
        }

        // Fetch object from database
        $db = $this->getConnection();
        $response = $db->get(
            $this->getDatabase() . urlencode( $id )
        );

        // Check if type of response matches type of class
        $this->checkTypeOfResponse( $response );

        // Create document contents from fetched object
        $this->fromResponse( $response );

        return $this;
    }
1325397
public function fetchById($id)
    {
        $data = $this->getProvider()->fetchById($id);
        return $this->resultAsModel($data);
    }
1034074
public function get(int $id)
    {
        $documents = $this->getClient()->call(null, $id, self::ENDPOINT, Document::class, true, 'GET');

        if (1 == count($documents)) {
            return current($documents);
        }

        return $documents;
    }
275003
public function get($id) {
        return $this->request("GET", self::URL_PLANS . $id . "/", $api_key = $this->culqi->api_key);
    }
796029
public static function get($id){
		if( isset(self::$instances[$id]) ){
			return self::$instances[$id];
		}
		return null;
	}
952750
public function getById($id)
    {
        $modelResult = $this->getRequest()->request(
            'GET',
            $this->getRequestUrl(sprintf('models/%s', $id))
        );

        return $this->getModelFromResult($modelResult);
    }
268285
public function getArticleById(string $id): Generator
    {
        yield from $this->sendCommand(new Command('ARTICLE', $id));

        $data = yield from $this->encoder->readData($this->stream);
        return Article::parse($data);
    }
326723
public function getObjectById($id)
    {
        if (isset($this->objects[$id])) {
            return $this->objects[$id];
        } else {
            return null;
        }
    }
274990
public function get($id) {
        return $this->request("GET", self::URL_ORDERS . $id . "/", $api_key = $this->culqi->api_key);
    }
918694
public function getById($id)
    {
        $id = (int) $id;
        $rowSet = $this->getTableGateway()->select([$this->getPrimaryKey() => $id]);
        $row = $rowSet->current();
        return $row;
    }
846821
public function &get($id)
    {
        if (isset($this->instances[$id])) {
            return $this->instances[$id];
        }

        $result = $this->resolve($id);

        if (array_key_exists($id, $this->instances)) {
            $this->instances[$id] = & $result;
        }

        return $result;
    }
1124850
public function getById($id)
    {
        $list = $this->getByCriteria($id, $this->getUniqueId());
        return reset($list);
    }
856973
public function get($id)
    {
        return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $id));
    }
555753
public function getRecord($id) {
		if(is_numeric($id)) {
			return parent::getRecord($id);
		} else {
			return ExternalContent::getDataObjectFor($id);
		}
	}
601773
public function fetchById($id)
    {
        if ($this->hasCache()) {
            $data = $this->getCacheItem($id);
            return $data;
        }
        return parent::fetchById($id);
    }
451184
public function findById($id)
    {
        if(!file_exists($path = $this->getPathForDocument($id))) {
            return false;
        }

        $fp       = fopen($path, 'r');
        $contents = fread($fp, filesize($path));
        fclose($fp);

        $data = $this->formatter->decode($contents);

        if($data === null) {
            return false;
        }

        $ext = $this->formatter->getFileExtension();

        $doc = new $this->documentClass((array) $data);
        $doc->setId($this->getIdFromPath($path, $ext));

        return $doc;
    }
1131656
public function getById(int $id)
    {
        $result = $this->builder->getById($id);

        if (isset($result[0])) {
            return self::instance($result[0]);
        }

        return null;
    }