當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。