Abstract utility class containing caching and sql loading function

package Gems
subpackage UtilAbstract
copyright Copyright (c) 2015 Erasmus MC
license New BSD License
since Class available since version 1.7.2 24-sep-2015 11:37:10

 Methods

Returns a callable if a method is called as a variable

__get(string $name) : \MUtil_Lazy_Call

Parameters

$name

string

Returns

\MUtil_Lazy_Call

Cleans up everything to a save cacheId

cleanupForCacheId(string $cacheId) : string
Static

Parameters

$cacheId

string

Returns

string

Utility function for loading a complete query from cache into objects

_getObjectsAllCached(string $cacheId, object $object, mixed $sql, array $binds = null, mixed $tags = array()) : array

Parameters

$cacheId

string

The class is prepended to this id

$object

object

The object to put the data in

$sql

mixed

string or \Zend_Db_Select

$binds

array

sql paramters

$tags

mixed

atring or array of strings

Returns

array

Utility function for loading a complete query from cache

_getSelectAllCached(string $cacheId, mixed $sql, array $binds = array(), mixed $tags = array()) : array

Parameters

$cacheId

string

The class is prepended to this id

$sql

mixed

string or \Zend_Db_Select

$binds

array

sql paramters

$tags

mixed

atring or array of strings

Returns

array

Utility function for loading a query paired from cache

_getSelectPairsCached(string $cacheId, mixed $sql, array $binds = array(), mixed $tags = array(), string $sort = null) : array

Parameters

$cacheId

string

The class is prepended to this id

$sql

mixed

string or \Zend_Db_Select

$binds

array

sql paramters

$tags

mixed

atring or array of strings

$sort

string

Optional function to sort on, only known functions will do

Returns

array

Utility function for loading a query from cache

_getSelectPairsProcessedCached(string $cacheId, mixed $sql, callable $function, array $binds = array(), mixed $tags = array(), string $sort = null) : array

Parameters

$cacheId

string

The class is prepended to this id

$sql

mixed

string or \Zend_Db_Select

$function

callable

The function called with each row to form the result

$binds

array

sql paramters

$tags

mixed

string or array of strings

$sort

string

Optional function to sort on, only known functions will do

Returns

array

Utility function for loading a query from cache

_getSelectProcessedCached(string $cacheId, mixed $sql, callable $function, string $keyField, mixed $tags = array(), string $sort = null) : array

Parameters

$cacheId

string

The class is prepended to this id

$sql

mixed

string or \Zend_Db_Select

$function

callable

The function called with each row to form the result

$keyField

string

The field containing the key for each row

$tags

mixed

string or array of strings

$sort

string

Optional function to sort on, only known functions will do

Returns

array

Sort the array using the specified sort function

_sortResult(array $result, \Gems\Util\strng $sort = 'asort'

Parameters

$result

array

$sort

\Gems\Util\strng

 Properties

 

$cache

$cache : \Zend_Cache_Core

Default

 

$db

$db : \Zend_Db_Adapter_Abstract

Default

 

$source

$source : \MUtil_Registry_Source

Default