FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Provider Class Reference
Inheritance diagram for Provider:
Thing Db Record

Public Member Functions

 __construct ($controller, $config)
 
 trans ($column, $key, $value, $params=null)
 Translates a value using the dataset. More...
 
 exists ($key, $value, $params=null)
 Check if a record exists in the dataset. More...
 
 search ($search, $order=null, $params=null, $offset=0, $limit=null)
 Search for records in the dataset. More...
 
 totals ($search, $totals, $params=null)
 Return the totals for selected columns. More...
 
 group ($search, $group, $column, $total, $limit=null, $params=null)
 Return the grouped totals for a column. More...
 
- Public Member Functions inherited from Thing
 propertyExists ($property)
 Check if a property exists (public or published). More...
 
 constants ($prefix=null)
 Return all constants. More...
 
 get ($key)
 Get one or more properties. More...
 
 set ($key, $value=null)
 Set one or more properties. More...
 
 __get ($key)
 
 __set ($key, $value)
 

Data Fields

const SEARCH_FROM = 'from'
 Search for values larger than the reference value. More...
 
const SEARCH_TO = 'to'
 Search for values smaller than the reference value. More...
 
const SEARCH_EXACT = 'exact'
 Search for values identical to the reference value (this may also be an array with. More...
 
const SEARCH_DATE = 'date'
 Search for a single date (24 hours). More...
 
const SEARCH_LIKE = 'like'
 Search for values that match reference value with wildcard (? = 1 char, * = multiple chars). More...
 
const SEARCH_RANGE = [self::SEARCH_FROM,self::SEARCH_TO]
 
const SEARCH_MULTI = 'multi'
 Pseudo type to allow for multiple values. More...
 
 $order = []
 Basic/default order (same format as search function). More...
 
 $format = null
 Format function to apply to each record (called with a single record by reference, and true as a. More...
 
- Data Fields inherited from Thing
const HIDDEN = 0
 Property is hidden. More...
 
const READABLE = 1
 Property is readable. More...
 
const WRITEABLE = 2
 Property is writeable. More...
 
const READWRITE = 3
 Property is readable and writeable. More...
 

Protected Member Functions

 _search ($search, $order, $params, $offset, $limit)
 
 _totals ($search, $totals, $params)
 
 _group ($search, $group, $column, $total, $limit, $params)
 
 setId ($value)
 
 getId ()
 
- Protected Member Functions inherited from Thing
 publish ($property, $visibility=self::READABLE)
 Publish a property (or hide it again). More...
 
 configure ($config)
 Configure the object. More...
 
 _get ($key)
 Default getter if no specific setter is defined, and the property is also not published (readable). More...
 
 _set ($key, $value)
 Default setter if no specific setter is defined, and the property is also not published (writeable). More...
 

Protected Attributes

 $_controller = null
 
 $_id = null
 
- Protected Attributes inherited from Thing
 $_published = []
 Published properties (key = name of property, value = visibility). More...
 

Detailed Description

Definition at line 5 of file Provider.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $controller,
  $config 
)

Definition at line 23 of file Provider.php.

Member Function Documentation

◆ _group()

_group (   $search,
  $group,
  $column,
  $total,
  $limit,
  $params 
)
protected

Definition at line 87 of file Provider.php.

◆ _search()

_search (   $search,
  $order,
  $params,
  $offset,
  $limit 
)
protected

Definition at line 49 of file Provider.php.

◆ _totals()

_totals (   $search,
  $totals,
  $params 
)
protected

Definition at line 70 of file Provider.php.

◆ exists()

exists (   $key,
  $value,
  $params = null 
)

Check if a record exists in the dataset.

Parameters
string$keyColumn to use to find the record.
mixed$valueValue to use to find the record.
array$paramsExtra parameters.
Returns
bool True if the record exists.

Definition at line 45 of file Provider.php.

◆ getId()

getId ( )
protected

Definition at line 114 of file Provider.php.

◆ group()

group (   $search,
  $group,
  $column,
  $total,
  $limit = null,
  $params = null 
)

Return the grouped totals for a column.

Parameters
array$searchSearch criteria (key = search type - see SEARCH_* constants, value = search compare value).
string$groupColumn to group by.
string$columnColumn to group the value for.
string$totalTotal type (see \Rsi\Fred\controller::TOTAL_* constants).
int$limitPositive for top, negative for bottom, zero for all (sorted by $column).
array$paramsExtra parameters.
Returns
array Key = group, value = total.

Definition at line 100 of file Provider.php.

◆ search()

search (   $search,
  $order = null,
  $params = null,
  $offset = 0,
  $limit = null 
)

Search for records in the dataset.

Parameters
array$searchSearch criteria (key = column, value = array with key = search type - see SEARCH_* constants, value = search reference value).
array$orderSort order for the result (key = column name, value = sort order - use PHP's SORT_* constants; SORT_ASC and SORT_DESC are always supported, combinations with SORT_NUMERIC, SORT_NATURAL and the like are depending on the type of provider and should also be shifted 4 bits up).
array$paramsExtra parameters.
int$offsetNumber of records to skip.
int$limitMaximum number of records to return (empty = all).
Returns
array Array with found records (key = column name).

Definition at line 64 of file Provider.php.

◆ setId()

setId (   $value)
protected

Definition at line 110 of file Provider.php.

◆ totals()

totals (   $search,
  $totals,
  $params = null 
)

Return the totals for selected columns.

Parameters
array$searchSearch criteria (key = search type - see SEARCH_* constants, value = search compare value).
array$totalsColumns to return the totals for, assoc.array (key = column name, value = total type - see \Rsi\Fred\controller::TOTAL_* constants, one or multiple in an array).
array$paramsExtra parameters.
Returns
array Array with totals (key = column name, value = total).

Definition at line 81 of file Provider.php.

◆ trans()

trans (   $column,
  $key,
  $value,
  $params = null 
)

Translates a value using the dataset.

Parameters
string$columnColumn to get the translated value from.
string$keyColumn to use to find the record.
mixed$valueValue to use to find the record.
array$paramsExtra parameters.
Returns
mixed Found value for the column (false = not found).

Definition at line 35 of file Provider.php.

Field Documentation

◆ $_controller

$_controller = null
protected

Definition at line 20 of file Provider.php.

◆ $_id

$_id = null
protected

Definition at line 21 of file Provider.php.

◆ $format

$format = null

Format function to apply to each record (called with a single record by reference, and true as a.

Definition at line 17 of file Provider.php.

◆ $order

$order = []

Basic/default order (same format as search function).

Definition at line 16 of file Provider.php.

◆ SEARCH_DATE

const SEARCH_DATE = 'date'

Search for a single date (24 hours).

Definition at line 11 of file Provider.php.

◆ SEARCH_EXACT

const SEARCH_EXACT = 'exact'

Search for values identical to the reference value (this may also be an array with.

Definition at line 9 of file Provider.php.

◆ SEARCH_FROM

const SEARCH_FROM = 'from'

Search for values larger than the reference value.

Definition at line 7 of file Provider.php.

◆ SEARCH_LIKE

const SEARCH_LIKE = 'like'

Search for values that match reference value with wildcard (? = 1 char, * = multiple chars).

Definition at line 12 of file Provider.php.

◆ SEARCH_MULTI

const SEARCH_MULTI = 'multi'

Pseudo type to allow for multiple values.

Definition at line 14 of file Provider.php.

◆ SEARCH_RANGE

const SEARCH_RANGE = [self::SEARCH_FROM,self::SEARCH_TO]

Definition at line 13 of file Provider.php.

◆ SEARCH_TO

const SEARCH_TO = 'to'

Search for values smaller than the reference value.

Definition at line 8 of file Provider.php.


The documentation for this class was generated from the following file: