本文整理汇总了PHP中Foo::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP Foo::retrieve方法的具体用法?PHP Foo::retrieve怎么用?PHP Foo::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foo
的用法示例。
在下文中一共展示了Foo::retrieve方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBelongsToWithImmediate
public function testBelongsToWithImmediate()
{
$t = new Thing();
$t->name = "sean";
$t->save();
$f = new Foo();
$f->name = "kate";
$t->associateWith($f);
$t1 = new Thing($t->id);
$t1->retrieve();
$f1 = new Foo($f->id);
$f1->retrieve(array('with' => array('thing' => array('join_strategy' => 'Immediate'))));
$this->assertTrue($t1->equals($f1->thing));
}
示例2: indirect
}
function indirect($other)
{
echo __METHOD__ . "\n";
$this = $other;
$result = $this = $other;
print $result->prop;
print $this->prop;
}
function retrieve(&$other)
{
echo __METHOD__ . "\n";
$other = $this;
}
}
$object = new Foo();
$object->prop = "Hello\n";
$other = new Foo();
$other->prop = "World\n";
$object->replace($other);
$object->indirect($other);
print $object->prop;
// still shows 'Hello'
$object->retrieve($other);
print $other->prop;
// shows 'Hello'
?>
===DONE===
--EXPECTF--
Fatal error: Cannot re-assign $this in %s on line %d, position %d
示例3: testTxInsertRollback
public function testTxInsertRollback()
{
$tx_cnx = $this->getCnxForTxn();
# begin a new cnx
$tx_cnx->beginTxn();
# create and save a foo on our new cnx
$foo = new Foo();
$foo->_setDb($tx_cnx);
$foo->name = "joe";
$foo->save();
# should be visible from txn
$tx_foo = new Foo($foo->id);
$tx_foo->_setDb($tx_cnx);
$ex = null;
try {
$tx_foo->retrieve();
} catch (Exception $e) {
$ex = $e;
}
$this->assertTrue(is_null($ex));
$this->assertEquals($foo->name, $tx_foo->name);
# rollback
$tx_cnx->rollbackTxn();
# should no longer be visible in txn
$tx_foo = new Foo($foo->id);
$tx_foo->_setDb($tx_cnx);
$ex = null;
try {
$tx_foo->retrieve();
} catch (Exception $e) {
$ex = $e;
}
$this->assertTrue(is_a($ex, 'Pfw_Exception_NotFound'));
}