本文整理匯總了PHP中Dao::queryWidgets方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dao::queryWidgets方法的具體用法?PHP Dao::queryWidgets怎麽用?PHP Dao::queryWidgets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dao
的用法示例。
在下文中一共展示了Dao::queryWidgets方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testTwoFullIterationsWithInterupt
public function testTwoFullIterationsWithInterupt()
{
$dao = new Dao();
$itr = new RewindableEntityIterator($dao->queryWidgets(), new WidgetDataMapper());
$results = array();
$i = 0;
foreach ($itr as $widget) {
if (++$i > 1) {
break;
}
$results[] = $widget;
}
$this->assertTrue(count($results) == 1);
$results = array();
/* Prints this time */
foreach ($itr as $widget) {
$results[] = $widget;
}
$this->assertTrue(count($results) == 3);
}
示例2: ClassLoader
<?php
namespace org\mizer;
require __DIR__ . '/src/ClassLoader.class.php';
spl_autoload_register(array(new ClassLoader(), 'load'));
/* Instantiate data ccess object */
$dao = new Dao();
/* Compose iterator from DAO ResultSet and Widget DataMapper */
$itr = new RewindableEntityIterator($dao->queryWidgets(), new WidgetDataMapper());
/* Prints this time */
foreach ($itr as $widget) {
print_r($widget);
}
/* Doesn't print this time */
foreach ($itr as $widget) {
print_r($widget);
}