Custom Fetch

Table of contents:

Brief

You can create your own custom fetch functions from within your own custom module extension.

Example

The following example is based on the example given by Bruce Morrison on the ez.no forums.

File: extension/ourcustom/modules/ourcustom/function_definition.php

<?php
 
$FunctionList = array();
$FunctionList['CustomFetch'] = array( 'name' => 'customfetch',
                                                  'operation_types' => array( 'read' ),
                                                  'call_method' => array( 'include_file' => 'extension/ourcustom/modules/ourcustom/ourcustomfunctioncollection.php',
                                                  'class' => 'OurCustomFunctionCollection',
                                                  'method' => 'fetchCustomFetch' ),
                                                  'parameter_type' => 'standard',
                                                  'parameters' => array(
                                                    array( 'name'     => 'the',
                                                               'type'     => 'integer',
                                                                'required' => true,
                                                                'default'  => 1
                                                      ),
                                                      array( 'name'     => 'params',
                                                                 'type'     => 'string',
                                                                 'required' => true,
                                                                 'default'  => ''
                                                              )
                                                      );
?>

File: extension/ourcustom/modules/ourcustom/ourcustomfunctioncollection.php

<?php
 
class OurCustomFunctionCollection
{
 function OurCustomFunctionCollection()
 {
 }
 function &fetchCustomFetch( $some, $params )
 {
   $result =& retrieve data here
   return array( 'result' => $result );
 }
}
 
?>

File: extension/ourcustom/settings/module.ini.append.php

<?php /* #?ini charset="utf-8"?
 
[ModuleSettings]
ExtensionRepositories[]=ourcustom
ModuleList[]=ourcustom
 
 
*/ ?>

Usage

{def $collection=fetch( ourcustom, customfetch, hash( the, params ) )}

External References