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


PHP AQueryWriter::clearRenames方法代码示例

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


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

示例1: testIssueWithDriverReturnID

 /**
  * Test whether a duplicate bean in the list isnt saved.
  * This was an issue with Postgres while testing the threeway tables.
  * Postgres returned the ID as a string while other drivers returned
  * a numeric value causing different outcome in array_diff when
  * calculating the shared additions.
  * 
  * @return void
  */
 public function testIssueWithDriverReturnID()
 {
     AQueryWriter::clearRenames();
     R::nuke();
     $book = R::dispense('book');
     $page = R::dispense('page');
     $book->sharedPageList[] = $page;
     R::store($book);
     asrt(R::count('page'), 1);
     $book = $book->fresh();
     $book->sharedPageList[] = $page;
     R::store($book);
     //don't save the duplicate bean!
     asrt(R::count('page'), 1);
     $book = $book->fresh();
     $page->item = 2;
     //even if we change a property ?
     $book->sharedPageList[] = $page;
     R::store($book);
     foreach ($book->sharedPageList as $listItem) {
         asrt(is_string($listItem->id), TRUE);
     }
     //same test but for own-list
     R::nuke();
     $book = R::dispense('book');
     $page = R::dispense('page');
     $book->ownPageList[] = $page;
     R::store($book);
     asrt(R::count('page'), 1);
     $book = $book->fresh();
     $book->ownPageList[] = $page;
     R::store($book);
     //don't save the duplicate bean!
     asrt(R::count('page'), 1);
     $book = $book->fresh();
     $book->ownPageList[] = $page;
     $page->item = 3;
     R::store($book);
     //don't save the duplicate bean!
     asrt(R::count('page'), 1);
     foreach ($book->ownPageList as $listItem) {
         asrt(is_string($listItem->id), TRUE);
     }
     AQueryWriter::clearRenames();
 }
开发者ID:skullyframework,项目名称:skully,代码行数:54,代码来源:Threeway.php

示例2: testViaPrettification

 /**
  * Test prettier tables using via().
  */
 public function testViaPrettification()
 {
     R::nuke();
     R::renameAssociation('tbl_author_tbl_friend', 'tbl_author_friend');
     $author = R::xdispense(AUTHOR);
     $author->name = 'Mr. Quill';
     $friend = R::xdispense(FRIEND);
     $friend->name = 'Muse';
     $author->{FRIENDLIST}[] = $friend;
     $id = R::store($author);
     //print_r(R::inspect()); exit;
     $author = R::load(AUTHOR, $id);
     $tables = array_flip(R::inspect());
     asrt(isset($tables['tbl_author_friend']), TRUE);
     asrt(isset($tables['tbl_author_tbl_friend']), FALSE);
     asrt(count($author->{FRIENDLIST}), 1);
     AQueryWriter::clearRenames();
 }
开发者ID:diego-vieira,项目名称:redbean,代码行数:21,代码来源:Prefixes.php

示例3: testIssue378


//.........这里部分代码省略.........
     $book = $book->fresh();
     $book->via('garbage')->nothing;
     asrt(count($book->sharedPageList), 1);
     //yet another
     $book = R::dispense('magazine');
     $book->ownAdList[] = R::dispense('ad');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('garbage')->ownAdList;
     asrt(count($book->sharedPageList), 1);
     $book = R::dispense('folder');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('garbage')->sharedItemList[] = R::dispense('item');
     asrt(count($book->sharedPageList), 1);
     $book = R::dispense('folder2');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('garbage')->sharedItemList[] = R::dispense('item');
     $book->via('garbage')->sharedItemList[] = R::dispense('item');
     asrt(count($book->sharedPageList), 1);
     $book = R::dispense('folder3');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('garbage')->item = R::dispense('item');
     asrt(count($book->sharedPageList), 1);
     $book = R::dispense('folder3');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('garbage')->item = 'test';
     asrt(count($book->sharedPageList), 1);
     //yet another
     $book = R::dispense('leaflet');
     $book->title = 'leaflet';
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('garbage')->title;
     asrt(count($book->sharedPageList), 1);
     //yet another
     $book = R::dispense('paper');
     $book->author = R::dispense('author');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('garbage')->author;
     asrt(count($book->sharedPageList), 1);
     $book = R::dispense('paper2');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('garbage')->author;
     asrt(count($book->sharedPageList), 1);
     //yet another one
     $book = R::dispense('archive');
     $book->sharedItem[] = R::dispense('item');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     unset($book->via('garbage')->sharedItem);
     asrt(count($book->sharedPageList), 1);
     //theoretic cases
     $book = R::dispense('guide');
     $book->sharedItem[] = R::dispense('item');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('relation')->countShared('item');
     $book->via('relation')->countShared('item');
     asrt(count($book->sharedPageList), 1);
     $book = R::dispense('catalogue');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('relation')->countShared('item');
     $book->via('relation')->countShared('item');
     asrt(count($book->sharedPageList), 1);
     $book = R::dispense('tabloid');
     $book->ownItemList[] = R::dispense('item');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('relation')->countOwn('item');
     $book->via('relation')->countOwn('item');
     asrt(count($book->sharedPageList), 1);
     $book = R::dispense('booklet');
     $book->ownItemList[] = R::dispense('item');
     $book->sharedPage[] = R::dispense('page');
     R::store($book);
     $book = $book->fresh();
     $book->via('relation')->countOwn('item');
     $book->via('relation')->countOwn('item');
     asrt(count($book->sharedPageList), 1);
     AQueryWriter::clearRenames();
 }
开发者ID:gabordemooij,项目名称:redbean,代码行数:101,代码来源:Via.php

示例4: testUniqueInspect

 /**
  * Test whether unique constraints are properly created using
  * reflection.
  *
  * @return void
  */
 public function testUniqueInspect()
 {
     $writer = R::getWriter();
     R::nuke();
     $book = R::dispense('book');
     $category = R::dispense('category');
     $book->sharedCategory[] = $category;
     R::store($book);
     asrt(count(get_uniques_for_type('book_category')), 1);
     asrt(are_cols_in_unique('book_category', array('book_id', 'category_id')), TRUE);
     R::nuke();
     $book = R::dispense('book');
     $category = R::dispense('category');
     $book->via('library')->sharedCategory[] = $category;
     R::store($book);
     asrt(count(get_uniques_for_type('book_category')), 0);
     asrt(are_cols_in_unique('book_category', array('book_id', 'category_id')), FALSE);
     asrt(count(get_uniques_for_type('library')), 1);
     asrt(are_cols_in_unique('library', array('book_id', 'category_id')), TRUE);
     AQueryWriter::clearRenames();
     R::nuke();
     $book = R::dispense('book');
     $category = R::dispense('category');
     $book->sharedCategory[] = $category;
     R::store($book);
     asrt(count(get_uniques_for_type('book_category')), 1);
     asrt(are_cols_in_unique('book_category', array('book_id', 'category_id')), TRUE);
     asrt(count(get_uniques_for_type('library')), 0);
     asrt(are_cols_in_unique('library', array('book_id', 'category_id')), FALSE);
     R::nuke();
     $book = R::dispense('book');
     $book2 = R::dispense('book');
     $book->sharedBook[] = $book2;
     R::store($book);
     asrt(count(get_uniques_for_type('book_book')), 1);
     asrt(are_cols_in_unique('book_book', array('book_id', 'book2_id')), TRUE);
     try {
         $result = R::getWriter()->addUniqueConstraint('nonexistant', array('a', 'b'));
     } catch (\Exception $e) {
         print_r($e);
         exit;
     }
     pass();
     //dont crash!
     asrt($result, FALSE);
 }
开发者ID:gabordemooij,项目名称:redbean,代码行数:52,代码来源:Foreignkeys.php


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