mirror of
https://github.com/dg/dibi.git
synced 2025-02-21 09:23:57 +01:00
31 lines
626 B
PHP
31 lines
626 B
PHP
<!DOCTYPE html><link rel="stylesheet" href="data/style.css">
|
|
|
|
<h1>Using Extension Methods | dibi</h1>
|
|
|
|
<?php
|
|
|
|
require dirname(__FILE__) . '/Nette/Debugger.php';
|
|
require dirname(__FILE__) . '/../dibi/dibi.php';
|
|
|
|
ndebug();
|
|
|
|
dibi::connect(array(
|
|
'driver' => 'sqlite3',
|
|
'database' => 'data/sample.s3db',
|
|
));
|
|
|
|
|
|
// 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();
|
|
dump($all);
|