1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-24 02:43:09 +01:00
php-dibi/examples/using-extension-methods.php

31 lines
626 B
PHP
Raw Normal View History

2010-08-03 12:28:07 +02:00
<!DOCTYPE html><link rel="stylesheet" href="data/style.css">
2010-08-03 11:48:51 +02:00
<h1>Using Extension Methods | dibi</h1>
2010-08-03 12:28:07 +02:00
2008-07-17 03:51:29 +00:00
<?php
2013-06-23 01:57:48 +02:00
require dirname(__FILE__) . '/Nette/Debugger.php';
require dirname(__FILE__) . '/../dibi/dibi.php';
2008-07-17 03:51:29 +00:00
2012-02-03 13:48:00 +01:00
ndebug();
2008-07-17 03:51:29 +00:00
dibi::connect(array(
'driver' => 'sqlite3',
'database' => 'data/sample.s3db',
2008-07-17 03:51:29 +00:00
));
// 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();
2012-02-03 13:48:00 +01:00
dump($all);