Fetch document by ID

Fetch the document of the given type with the given ID. Throws a
phpillowNoSuchPropertyException if the document does not exist.

@param string $name
@param string $id
@return phpillowDocument
767684
public static function fetchDocument( $name, $id )
    {
        // Check if a document with the given name exists.
        if ( !isset( self::$documents[$name] ) )
        {
            throw new phpillowNoSuchPropertyException( $name );
        }

        // Instantiate and return document.
        $className = self::$documents[$name];
        $document  = new $className();
        return $document->fetchById( $id );
    }
240324
public function get($index, $type, $id)
    {
        $request = $this->createRequestInstance(self::GET_DOCUMENT, $index, $type);
        $request->setId($id);

        return $this->client->send($request);
    }
1094910
public Document getDocument(@NonNull String id) {
        if (id == null) { throw new IllegalArgumentException("id cannot be null."); }

        synchronized (lock) {
            mustBeOpen();
            try {
                return new Document((Database) this, id, false);
            }
            catch (CouchbaseLiteException ex) {
                // only 404 - Not Found error throws CouchbaseLiteException
                return null;
            }
        }
    }
1274304
public function getTypeOid($name)
    {
        $ret = pg_field_type_oid($this->handler, $name);

        if ($ret === false) {
            throw new FoundationException(
                sprintf(
                    "Error while fetching type oid for field '%s'.",
                    $name
                )
            );
        }

        return $ret;
    }
254780
public function findOneById($id)
    {
        try {
            return $this->_documentHandler->getById($this->_collectionName, $id);
        } catch (ServerException $e) {
            if ($e->getServerMessage() === 'document not found') {
                return null;
            }
            throw $e;
        }
    }
750471
public function find($id)
    {
        $resourceName = constant($this->type . '::RESOURCE');

        $url      = sprintf("%s/%s/%s", self::ENDPOINT, $resourceName, $id);
        $response = $this->fetch($url, substr($resourceName, 0, strlen($resourceName) - 1));

        return new $this->type($response);
    }
1369109
public function show($id)
    {
        $documentRepository = new DocumentRepository();
        $file = $documentRepository->getFile( $id );
        return response( $file, 200 )->header( 'Content-Type', 'image/jpeg' );
    }
705725
static function fetchByID( $id ,$asObject = true )
    {
        $cond = array( 'id' => $id );
        return eZPersistentObject::fetchObject( eZNodeAssignment::definition(),
                                                null, $cond,
                                                $asObject );
    }
1244441
public function remove($name, $id)
    {
        $this->client->remove(
            $this->capabilities->get($name)->getUrl() . (string) $id
        );

        return $this;
    }
968419
public static function getNew($id, $name = '')
    {
        $container = self::getContainer($name);

        return $container->getNew($id);
    }
671498
public static function retrieve(string $className, string $id)
    {
        return self::repositoryFor($className)->retrieve($id);
    }
827913
public function findById($id,$idName = 'id')
    {

        $this->sql = "SELECT {$this->_fields} FROM {$this->_table} where $idName= " . (int)$id;
        $stmt = $this->execute();
        return $stmt->fetch(\PDO::FETCH_ASSOC);
    }
331459
public function fetch( $id ) {

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

		$this->cacheMisses++;
		return false;
	}
303121
public function create(string $name, int $id = 0): array
    {
        $json = ['tagname' => $name];

        if ($id > 0) {
            $json['tagid'] = $id;
        }

        return $this->httpClient->postJson('tag/create', $json);
    }
754457
public function createDocument($name)
    {
        foreach ($this->registry[DocumentExtension::class] as $extension) {
            $node = $extension->createDocument($this, $name);
            if ($node) {
                return $node;
            }
        }

        return null;
    }
915184
public function getContentTypeById($id)
    {
        return $this->om->getRepository($this->configurationManager->getEntityClass('content_type'))->find($id);
    }
626021
public function fetchById($id)
    {
        $data = parent::fetchById($id);
        if ($data) {
            foreach (array_keys($this->subAttributeList) as $subKey) {
                $data[$subKey] = $this->fetchSubAttributeById($id, $subKey);
            }
        }
        return $data;
    }