Custom Fetch

Table of contents:

Brief

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

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 );
 }
}
 
?>

Usage

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

External References