lib/Doctrine/CouchDB/CouchDBClient.php
public function createDesignDocument($designDocName, DesignDocument $designDoc)
    {
        $data = $designDoc->getData();
        $data['_id'] = '_design/'.$designDocName;

        $documentPath = '/'.$this->databaseName.'/'.$data['_id'];
        $response = $this->httpClient->request('GET', $documentPath);

        if ($response->status == 200) {
            $docData = $response->body;
            $data['_rev'] = $docData['_rev'];
        }

        return $this->httpClient->request(
            'PUT',
            sprintf('/%s/_design/%s', $this->databaseName, $designDocName),
            json_encode($data)
        );
    }
public function createDesignDocument($designDocName, DesignDocument $designDoc)
    {
        $data = $designDoc->getData();
        $data['_id'] = '_design/'.$designDocName;

        $documentPath = '/'.$this->databaseName.'/'.$data['_id'];
        $response = $this->httpClient->request('GET', $documentPath);

        if ($response->status == 200) {
            $docData = $response->body;
            $data['_rev'] = $docData['_rev'];
        }

        return $this->httpClient->request(
            'PUT',
            sprintf('/%s/_design/%s', $this->databaseName, $designDocName),
            json_encode($data)
        );
    }
public function createDesignDocument ( $ designDocName , DesignDocument $ designDoc ) { $ data = $ designDoc -> getData ( ) ; $ data [ '_id' ] = '_design/' . $ designDocName ; $ documentPath = '/' . $ this -> databaseName . '/' . $ data [ '_id' ] ; $ response = $ this -> httpClient -> request ( 'GET' , $ documentPath ) ; if ( $ response -> status == 200 ) { $ docData = $ response -> body ; $ data [ '_rev' ] = $ docData [ '_rev' ] ; } return $ this -> httpClient -> request ( 'PUT' , sprintf ( '/%s/_design/%s' , $ this -> databaseName , $ designDocName ) , json_encode ( $ data ) ) ; }
Create or update a design document from the given in memory definition.

@param string         $designDocName
@param DesignDocument $designDoc

@return HTTP\Response
Create or update a design document from the given in memory definition .