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;
    }
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;
    }
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 ; }
Get document by ID

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

@param string $id
@return phpillowDocument
Get document by ID