本文整理汇总了PHP中DBObject::purgeInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP DBObject::purgeInstance方法的具体用法?PHP DBObject::purgeInstance怎么用?PHP DBObject::purgeInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObject
的用法示例。
在下文中一共展示了DBObject::purgeInstance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLazyLoad
function testLazyLoad()
{
$this->getDB();
$childID = $this->db->queryValue('SELECT ID FROM Test WHERE Parent = ? LIMIT 1', $GLOBALS['FirstObjectID']);
DBObject::purgeInstance('DBTest', $GLOBALS['FirstObjectID']);
$child = DBTest::get($childID);
$r = new ReflectionObject($child);
foreach ($r->getProperties() as $prop) {
$this->assertNotEquals($prop->getName(), 'Parent');
// Parent should not be defined as we have not yet accessed it
}
$foo = $child->Parent;
$this->assertType('object', $foo);
$this->assertEquals($foo->ID, $GLOBALS['FirstObjectID']);
$found = false;
foreach ($r->getProperties() as $prop) {
if ($prop->getName() == 'Parent') {
$found = true;
}
}
$this->assertTrue($found);
}