当前位置: 首页>>代码示例>>PHP>>正文


PHP RedBean_OODBBean::setFlagKeyedExport方法代码示例

本文整理汇总了PHP中RedBean_OODBBean::setFlagKeyedExport方法的典型用法代码示例。如果您正苦于以下问题:PHP RedBean_OODBBean::setFlagKeyedExport方法的具体用法?PHP RedBean_OODBBean::setFlagKeyedExport怎么用?PHP RedBean_OODBBean::setFlagKeyedExport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RedBean_OODBBean的用法示例。


在下文中一共展示了RedBean_OODBBean::setFlagKeyedExport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ExportWithFilters

 /**
  * 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::$duplicationManager->setTables(R::$writer->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::preload($texts, 'page,*.book,*.author');
     $objects = R::exportAll($texts, TRUE);
     asrt(isset($objects[0]['page']['book']['author']['publisher']), TRUE);
     asrt(isset($objects[0]['page']['sharedBookmark']), FALSE);
     $texts = R::find('text');
     R::preload($texts, array('page', 'page.sharedBookmark' => 'bookmark'));
     $objects = R::exportAll($texts, TRUE);
     asrt(isset($objects[0]['page']['book']['author']['publisher']), TRUE);
     asrt(isset($objects[0]['page']['sharedBookmark']), TRUE);
     asrt(isset($objects[0]['page']['sharedBookmark'][0]['ownNote']), FALSE);
     $texts = R::find('text');
     R::preload($texts, array('page', 'page.sharedBookmark' => 'bookmark', 'page.sharedBookmark.ownNote' => 'note'));
     $objects = R::exportAll($texts, TRUE);
     asrt(isset($objects[0]['page']['book']['author']['publisher']), TRUE);
     asrt(isset($objects[0]['page']['sharedBookmark']), TRUE);
     asrt(isset($objects[0]['page']['sharedBookmark'][0]['ownNote']), TRUE);
     R::$duplicationManager->setCacheTables(FALSE);
     testpack('Keyless export');
     $book = R::load('book', $bookID);
     $book->ownPage;
     $export = $book->export();
     asrt(isset($export['ownPage'][0]), TRUE);
     RedBean_OODBBean::setFlagKeyedExport(TRUE);
     $export = $book->export();
     asrt(isset($export['ownPage'][1]), TRUE);
     RedBean_OODBBean::setFlagKeyedExport(FALSE);
     $export = $book->export();
     asrt(isset($export['ownPage'][0]), TRUE);
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:89,代码来源:Dup.php


注:本文中的RedBean_OODBBean::setFlagKeyedExport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。