setNarrowFieldMode() public static method

See documentation in QueryWriter.
public static setNarrowFieldMode ( boolean $mode ) : void
$mode boolean TRUE = Narrow Field Mode
return void
Example #1
0
 /**
  * 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);
 }
Example #2
0
 /**
  * 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);
 }