本文整理匯總了PHP中RedBeanPHP\Facade::setNarrowFieldMode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Facade::setNarrowFieldMode方法的具體用法?PHP Facade::setNarrowFieldMode怎麽用?PHP Facade::setNarrowFieldMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RedBeanPHP\Facade
的用法示例。
在下文中一共展示了Facade::setNarrowFieldMode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSystemWideSettingsForJoins
/**
* Tests R::setNarrowFieldMode() and
* OODBBean::ignoreJoinFeature().
*/
public function testSystemWideSettingsForJoins()
{
R::nuke();
$author = R::dispense('author');
$book = R::dispense('book');
$info = R::dispense('info');
$info->title = 'x';
$author->xownBookList[] = $book;
$book->info = $info;
R::store($author);
$author = $author->fresh();
$books = $author->withCondition(' @joined.info.title != ? ', array('y1'))->xownBookList;
$firstBook = reset($books);
asrt(isset($firstBook->title), FALSE);
R::setNarrowFieldMode(FALSE);
$author = $author->fresh();
$books = $author->withCondition(' @joined.info.title != ? ', array('y2'))->xownBookList;
$firstBook = reset($books);
asrt(isset($firstBook->title), TRUE);
R::setNarrowFieldMode(TRUE);
}
示例2: testExplicitCacheFlush
/**
* Test explicit flush.
*
* @return void
*/
public function testExplicitCacheFlush()
{
testpack('Test cache flush (explicit)');
R::setNarrowFieldMode(FALSE);
R::debug(true, 1);
$logger = R::getDatabaseAdapter()->getDatabase()->getLogger();
$bean = R::dispense('bean');
$bean->title = 'abc';
$id1 = R::store($bean);
$logger->clear();
$bean = R::load('bean', $id1);
asrt($bean->title, 'abc');
asrt(count($logger->grep('SELECT *')), 1);
$bean = R::load('bean', $id1);
asrt(count($logger->grep('SELECT *')), 1);
R::getWriter()->flushCache();
$bean = R::load('bean', $id1);
asrt(count($logger->grep('SELECT *')), 2);
R::getWriter()->flushCache();
R::getWriter()->setUseCache(FALSE);
R::setNarrowFieldMode(TRUE);
}