本文整理汇总了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);
示例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());