mirror of
https://github.com/dg/dibi.git
synced 2025-07-31 19:30:30 +02:00
examples: files renamed
This commit is contained in:
30
examples/using-extension-methods.php
Normal file
30
examples/using-extension-methods.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html><link rel="stylesheet" href="data/style.css">
|
||||
|
||||
<h1>Using Extension Methods | dibi</h1>
|
||||
|
||||
<?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);
|
Reference in New Issue
Block a user