當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Foo::retrieve方法代碼示例

本文整理匯總了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));
 }
開發者ID:seansitter,項目名稱:picnicphp,代碼行數:14,代碼來源:Pfw_Model_Test.php

示例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
開發者ID:lihuibin,項目名稱:jphp,代碼行數:31,代碼來源:this.php

示例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'));
 }
開發者ID:seansitter,項目名稱:picnicphp,代碼行數:34,代碼來源:Pfw_Model_Mysqli_Test.php


注:本文中的Foo::retrieve方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。