private function createDocumentAttachments($documentId, $data)
{
$attachments = array();
$client = $this->dm->getHttpClient();
$basePath = '/' . $this->dm->getCouchDBClient()->getDatabase() . '/' . $documentId . '/';
foreach ($data as $filename => $attachment) {
if (isset($attachment['stub']) && $attachment['stub']) {
$instance = Attachment::createStub($attachment['content_type'], $attachment['length'], $attachment['revpos'], $client, $basePath . $filename);
} else {
if (isset($attachment['data'])) {
$instance = Attachment::createFromBase64Data($attachment['data'], $attachment['content_type'], $attachment['revpos']);
}
}
$attachments[$filename] = $instance;
}
return $attachments;
}