本文整理汇总了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);
}