lib/Doctrine/CouchDB/Attachment.php
public function toArray()
    {
        if ($this->stub) {
            $json = ['stub' => true];
        } else {
            $json = ['data' => $this->getBase64EncodedData()];
            if ($this->contentType) {
                $json['content_type'] = $this->contentType;
            }
        }

        return $json;
    }
public function toArray()
    {
        if ($this->stub) {
            $json = ['stub' => true];
        } else {
            $json = ['data' => $this->getBase64EncodedData()];
            if ($this->contentType) {
                $json['content_type'] = $this->contentType;
            }
        }

        return $json;
    }
public function toArray ( ) { if ( $ this -> stub ) { $ json = [ 'stub' => true ] ; } else { $ json = [ 'data' => $ this -> getBase64EncodedData ( ) ] ; if ( $ this -> contentType ) { $ json [ 'content_type' ] = $ this -> contentType ; } } return $ json ; }
Attachments are special in how they need to be persisted depending on stub or not.

TODO: Is this really necessary with all this special logic? Having attahments as special
case without special code would be really awesome.

@return string
Attachments are special in how they need to be persisted depending on stub or not .