1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-19 00:36:17 +02:00
Files
php-dibi/examples/extension.method.php
2010-08-03 13:41:05 +02:00

29 lines
529 B
PHP

<h1>dibi extension method example</h1>
<pre>
<?php
require_once 'Nette/Debug.php';
require_once '../dibi/dibi.php';
dibi::connect(array(
'driver' => 'sqlite',
'database' => 'data/sample.sdb',
));
// using the "prototype" to add custom method to class DibiResult
function DibiResult_prototype_fetchShuffle(DibiResult $obj)
{
$all = $obj->fetchAll();
shuffle($all);
return $all;
}
// fetch complete result set shuffled
$res = dibi::query('SELECT * FROM [customers]');
$all = $res->fetchShuffle();
Debug::dump($all);