Returns the current duplication manager instance.
public static getDuplicationManager ( ) : DuplicationManager | ||
return | DuplicationManager |
/** * Test exporting with filters. * * @return void */ public function ExportWithFilters() { testpack('Export with filters'); $book = R::dispense('book'); $pages = R::dispense('page', 2); $texts = R::dispense('text', 2); $images = R::dispense('image', 2); $author = R::dispense('author'); $pub = R::dispense('publisher'); $bookmarks = R::dispense('bookmark', 2); $pages[0]->ownText = array($texts[0]); $pages[0]->ownImage = array($images[0]); $pages[1]->ownText = array($texts[1]); $pages[1]->ownImage = array($images[1]); $pages[0]->sharedBookmark[] = $bookmarks[0]; $pages[1]->sharedBookmark[] = $bookmarks[1]; $bookmarks[0]->ownNote[] = R::dispense('note')->setAttr('text', 'a note'); $bookmarks[1]->ownNote[] = R::dispense('note')->setAttr('text', 'a note'); $book->ownPage = $pages; $book->author = $author; $author->publisher = $pub; $bookID = R::store($book); R::getDuplicationManager()->setTables(R::getWriter()->getTables()); $objects = R::exportAll(array($book), TRUE, array()); asrt(isset($objects[0]['ownPage']), TRUE); asrt(count($objects[0]['ownPage']), 2); asrt(isset($objects[0]['author']), TRUE); asrt(isset($objects[0]['ownPage'][0]['ownText']), TRUE); asrt(count($objects[0]['ownPage'][0]['ownText']), 1); asrt(isset($objects[0]['ownPage'][0]['ownImage']), TRUE); asrt(count($objects[0]['ownPage'][0]['ownImage']), 1); $objects = R::exportAll(array($book), TRUE, array('page', 'author', 'text', 'image')); asrt(isset($objects[0]['ownPage']), TRUE); asrt(count($objects[0]['ownPage']), 2); asrt(isset($objects[0]['author']), TRUE); asrt(isset($objects[0]['ownPage'][0]['ownText']), TRUE); asrt(count($objects[0]['ownPage'][0]['ownText']), 1); asrt(isset($objects[0]['ownPage'][0]['ownImage']), TRUE); asrt(count($objects[0]['ownPage'][0]['ownImage']), 1); $objects = R::exportAll(array($book), TRUE, 'author'); asrt(isset($objects[0]['ownPage']), FALSE); asrt(isset($objects[0]['ownPage'][0]['ownText']), FALSE); $objects = R::exportAll(array($book), TRUE, array('page')); asrt(isset($objects[0]['author']), FALSE); asrt(isset($objects[0]['ownPage'][0]['ownText']), FALSE); $objects = R::exportAll(array($book), TRUE, array('page', 'text')); asrt(isset($objects[0]['author']), FALSE); asrt(isset($objects[0]['ownPage']), TRUE); asrt(isset($objects[0]['ownPage'][0]['ownText']), TRUE); asrt(count($objects[0]['ownPage'][0]['ownText']), 1); asrt(isset($objects[0]['ownPage'][0]['ownImage']), FALSE); $objects = R::exportAll(array($book), TRUE, array('none')); asrt(isset($objects[0]['author']), FALSE); asrt(isset($objects[0]['ownPage']), FALSE); $texts = R::find('text'); R::getDuplicationManager()->setCacheTables(FALSE); testpack('Keyless export'); $book = R::load('book', $bookID); $book->ownPage; $export = $book->export(); asrt(isset($export['ownPage'][0]), TRUE); }