本文整理汇总了PHP中RedBeanPHP\Facade::setAutoResolve方法的典型用法代码示例。如果您正苦于以下问题:PHP Facade::setAutoResolve方法的具体用法?PHP Facade::setAutoResolve怎么用?PHP Facade::setAutoResolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanPHP\Facade
的用法示例。
在下文中一共展示了Facade::setAutoResolve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAutoResolvAvoid
/**
* Test whether aliases are not used if not necessary:
* when using fetchAs() or R::aliases().
*
* @return void
*/
public function testAutoResolvAvoid()
{
R::setAutoResolve(TRUE);
R::nuke();
$book = R::dispense('book');
$page = R::dispense('page');
$book->cover = $page;
R::store($book);
$book = $book->fresh();
asrt($book->getMeta('sys.autoresolved.cover'), NULL);
$book->cover;
asrt($book->getMeta('sys.autoresolved.cover'), 'page');
R::nuke();
$book = R::dispense('book');
$page = R::dispense('page');
$book->cover = $page;
R::store($book);
$book = $book->fresh();
asrt($book->getMeta('sys.autoresolved.cover'), NULL);
$book->fetchAs('page')->cover;
asrt($book->getMeta('sys.autoresolved.cover'), NULL);
R::nuke();
R::aliases(array('cover' => 'page'));
$book = R::dispense('book');
$page = R::dispense('page');
$book->cover = $page;
R::store($book);
$book = $book->fresh();
asrt($book->getMeta('sys.autoresolved.cover'), NULL);
$cover = $book->cover;
asrt($cover instanceof OODBBean, TRUE);
asrt($cover->getMeta('type'), 'page');
asrt($book->getMeta('sys.autoresolved.cover'), NULL);
R::aliases(array());
R::nuke();
R::setAutoResolve(FALSE);
$book = R::dispense('book');
$page = R::dispense('page');
$book->cover = $page;
R::store($book);
$book = $book->fresh();
asrt($book->getMeta('sys.autoresolved.cover'), NULL);
$book->cover;
asrt($book->getMeta('sys.autoresolved.cover'), NULL);
R::setAutoResolve(TRUE);
}