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


PHP Foo::find方法代碼示例

本文整理匯總了PHP中Foo::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Foo::find方法的具體用法?PHP Foo::find怎麽用?PHP Foo::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Foo的用法示例。


在下文中一共展示了Foo::find方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: microtime

if (++$counter == $test || $test == null) {
    $mark = microtime(true);
    for ($i = 0; $i < 1000; $i++) {
        $rs = lmbActiveRecord::find('Foo', array('proxy' => true));
        foreach ($rs as $obj) {
            $foo = $obj->bar;
        }
    }
    echo "{$counter}) lmbActiveRecord fetching(proxied), attr access: " . (microtime(true) - $mark) . "\n";
}
if (++$counter == $test || $test == null) {
    $mark = microtime(true);
    $rs = lmbActiveRecord::find('Foo');
    for ($i = 0; $i < 1000; $i++) {
        foreach ($rs as $obj) {
            $foo = $obj->bar;
        }
    }
    echo "{$counter}) lmbActiveRecord fetching(out of loop), attr access: " . (microtime(true) - $mark) . "\n";
}
if (++$counter == $test || $test == null) {
    $mark = microtime(true);
    for ($i = 0; $i < 1000; $i++) {
        $rs = Foo::find();
        foreach ($rs as $obj) {
            $foo = $obj->get('bar');
        }
    }
    echo "{$counter}) Foo fetching, getter: " . (microtime(true) - $mark) . "\n";
}
@unlink($db);
開發者ID:snowjobgit,項目名稱:limb,代碼行數:31,代碼來源:fetching.php

示例2: var_dump

echo "Foo::count(array('name' => 'bar'));";
var_dump(Foo::count(array('name' => 'bar')));
echo "Foo::find(array('name' => 'ba%'));";
var_dump(Foo::find(array('name' => 'ba%')));
echo "Foo::find(null, null, 1);";
var_dump(Foo::find(null, null, 1));
echo '<hr>';
$foo = new Foo(null, 'miam');
var_dump($foo->isNew());
$foo->save();
$foo = Foo::find($foo->id);
var_dump($foo);
$foo->name = 'miam 2';
$foo->save();
$foo = Foo::find($foo->id);
var_dump($foo);
$foo->delete();
$foo = Foo::find($foo->id);
var_dump($foo);
echo '<hr>';
$property = new ReflectionProperty('Foo', 'em');
$property->setAccessible(true);
$property->setValue(null);
$property = new ReflectionProperty('Foo', 'table');
$property->setAccessible(true);
$property->setValue('foo2');
$property = new ReflectionProperty('Foo', 'fields');
$property->setAccessible(true);
$property->setValue('name,location');
echo "Foo::getEntityManager();";
var_dump(Foo::getEntityManager());
開發者ID:cyve,項目名稱:orm,代碼行數:31,代碼來源:EntityTest.php


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