FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Def Class Reference
Inheritance diagram for Def:
Component Thing

Public Member Functions

 generateDatabaseStructure ($table_trans=null)
 Generate a definition file from the database structure. More...
 
 table ($table)
 Table definition (all columns). More...
 
 key ($table)
 Primary key columns. More...
 
 column ($table, $column, $extra=null)
 Column definition. More...
 
 value ($table, $column, $key, $default=null)
 Definition value. More...
 
 ref ($table, $column)
 Get the base (referenced) column. More...
 
 convert ($type, $value)
 Convert a single value from database format to standard, internal format. More...
 
 convertColumn ($column, $value, $tables)
 Convert a single column value from database format to standard, internal format. More...
 
 convertRecord ($record, $tables)
 Convert a record from database format to standard, internal format. More...
 
 format ($type, $value)
 Format a value from standard, internal format to database format. More...
 
 formatColumn ($column, $value, $tables)
 Convert a single column value from standard, internal format to database format. More...
 
 formatRecord ($record, $tables)
 Format a value from standard, internal format to database format. More...
 
 __call ($func_name, $params)
 
- Public Member Functions inherited from Component
 __construct ($fred, $config=null)
 
 __destruct ()
 
 clientConfig ()
 Public configuration. More...
 
 config ($key, $default=null)
 Retrieve a config value. More...
 
 ping ()
 Ping function. More...
 
 filemtime ($filename)
 Filemtime with session cache. More...
 
 component ($name)
 Get a component (local or default). More...
 
 components (... $names)
 Get multiple components in an array. 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

 $databaseStructureFilename = null
 
 $filename = null
 
 $boolTrue = 1
 
 $boolFalse = 0
 
 $charLimit = 128
 
- Data Fields inherited from Component
 $filemtimeTtl = 0
 
- 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

 getDef ()
 
- Protected Member Functions inherited from Component
 init ()
 
 done ()
 
 getSession ()
 
- 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

 $_def = null
 
- Protected Attributes inherited from Component
 $_fred = null
 
 $_config = null
 
 $_name = null
 
 $_components = []
 Local components (key = component name, value = component). More...
 
 $_session = null
 
- Protected Attributes inherited from Thing
 $_published = []
 Published properties (key = name of property, value = visibility). More...
 

Detailed Description

Definition at line 7 of file Def.php.

Member Function Documentation

◆ __call()

__call (   $func_name,
  $params 
)

Definition at line 250 of file Def.php.

◆ column()

column (   $table,
  $column,
  $extra = null 
)

Column definition.

Parameters
string$tableTable name.
string$columnColumn name.
array$extraExtra properties to add to the definition.
Returns
array Definition (including referenced definitions).

Definition at line 127 of file Def.php.

◆ convert()

convert (   $type,
  $value 
)

Convert a single value from database format to standard, internal format.

Parameters
string$typeColumn type.
mixed$valueValue in database format.
Returns
mixed Value in standard, internal format.

Definition at line 170 of file Def.php.

◆ convertColumn()

convertColumn (   $column,
  $value,
  $tables 
)

Convert a single column value from database format to standard, internal format.

Parameters
string$columnColumn name.
mixed$valueValue in database format.
array$tablesTables for the column.
Returns
mixed Value in standard, internal format.

Definition at line 184 of file Def.php.

◆ convertRecord()

convertRecord (   $record,
  $tables 
)

Convert a record from database format to standard, internal format.

Parameters
array$recordRecord in database format.
array$tablesTables for the column.
Returns
array Record in standard, internal format.

Definition at line 195 of file Def.php.

◆ format()

format (   $type,
  $value 
)

Format a value from standard, internal format to database format.

Parameters
string$typeColumn type.
mixed$valueValue in standard, internal format.
Returns
mixed Value in database format.

Definition at line 206 of file Def.php.

◆ formatColumn()

formatColumn (   $column,
  $value,
  $tables 
)

Convert a single column value from standard, internal format to database format.

Parameters
string$columnColumn name.
mixed$valueValue in standard, internal format.
array$tablesTables for the column.
Returns
mixed Value in database format.

Definition at line 221 of file Def.php.

◆ formatRecord()

formatRecord (   $record,
  $tables 
)

Format a value from standard, internal format to database format.

Parameters
array$recordRecord in standard, internal format.
array$tablesTables for the column.
Returns
array Record in database format.

Definition at line 232 of file Def.php.

◆ generateDatabaseStructure()

generateDatabaseStructure (   $table_trans = null)

Generate a definition file from the database structure.

Parameters
string$table_transTransformation method to use for the table name.
See also
\Rsi\Str::transform()

Definition at line 23 of file Def.php.

◆ getDef()

getDef ( )
protected

Definition at line 241 of file Def.php.

◆ key()

key (   $table)

Primary key columns.

Parameters
string$table
Returns
array

Definition at line 115 of file Def.php.

◆ ref()

ref (   $table,
  $column 
)

Get the base (referenced) column.

Parameters
string$table
string$column
Returns
string Base column name.

Definition at line 157 of file Def.php.

◆ table()

table (   $table)

Table definition (all columns).

Parameters
string$table
Returns
array Key = column, value = definition.

Definition at line 107 of file Def.php.

◆ value()

value (   $table,
  $column,
  $key,
  $default = null 
)

Definition value.

Parameters
string$tableTable name.
string$columnColumn name.
string$keyKey of value.
mixed$defaultDefault value if the key is not present in the definition.

Definition at line 148 of file Def.php.

Field Documentation

◆ $_def

$_def = null
protected

Definition at line 16 of file Def.php.

◆ $boolFalse

$boolFalse = 0

Definition at line 13 of file Def.php.

◆ $boolTrue

$boolTrue = 1

Definition at line 12 of file Def.php.

◆ $charLimit

$charLimit = 128

Definition at line 14 of file Def.php.

◆ $databaseStructureFilename

$databaseStructureFilename = null

Definition at line 9 of file Def.php.

◆ $filename

$filename = null

Definition at line 10 of file Def.php.


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