Merge

Merge other document into current document.

Description

$this Document::merge(Document $newDoc [, int $mode = Document::MERGE_CONFIG])

Parameters

Modes

| Mode Constant | Mode Description | |-----------------------|------------------------------------------------------------------------------| | MERGECONFIG | Merge only config. | | MERGECONTENTREPLACE | Merge only content. Replaces current content with that from merging document | | MERGECONTENTAPPEND | Merge only content. Appends content from merging document to current one. | | MERGEALLREPLACE | Merge both config and content. Same as `MERGECONTENTREPLACE`. | | MERGEALLAPPEND | Merge both config and content. Same as `MERGECONTENT_APPEND`. |

Return Value

Usage

$document = new Document('Lorem Ipsum dol sidur.....', ['title'=> 'Not A Random Title', 'layout' => 'grid']);
$newDoc = new Document('Lorem Ipsum.....', ['title'=> 'Random Title', 'category' => 'just another category']);

$document->merge($newDoc);

$document->getConfig();
//['title'=> 'Random Title', 'layout'=> 'grid', 'category' => 'just another category']