PHP Class MetaModels\Attribute\BaseSimple

Simple fields are fields that only consist of one column in the metamodel table and therefore do not need to be handled as complex fields must be.
Inheritance: extends Base, implements MetaModels\Attribute\ISimple
ファイルを表示 Open project: metamodels/core Class Usage Examples

Public Methods

Method Description
createColumn ( ) : void Creates the underlying database structure for this field.
deleteColumn ( ) : void Removes the underlying database structure for this field.
destroyAUX ( ) : void Create auxiliary data like a column in the MetaModel table or references in another table etc.
getFilterOptions ( $idList, $usedOnly, &$arrCount = null ) {@inheritDoc}
getSQLDataType ( ) : string Returns the SQL primitive type declaration in MySQL notation.
handleMetaChange ( string $strMetaName, mixed $varNewValue ) : MetaModels\Attribute\IAttribute Updates the meta information of the attribute.
initializeAUX ( ) : void Delete all auxiliary data like a column in the MetaModel table or references in another table etc.
renameColumn ( string $strNewColumnName ) : void Renames the underlying database structure for this field.
searchFor ( string $strPattern ) : int[] Search all items that match the given expression.
serializeData ( mixed $value ) : string Take the unserialized data and serialize it for the native DB column.
setDataFor ( mixed $arrValues ) : void This method is called to store the data for certain items to the database.
sortIds ( $idList, $strDirection )
unserializeData ( string $value ) : mixed Take the raw data from the DB column and unserialize it.

Method Details

createColumn() public method

You have to override this function in field types, when you want to have multi column structure etc.
public createColumn ( ) : void
return void

deleteColumn() public method

Removes the underlying database structure for this field.
public deleteColumn ( ) : void
return void

destroyAUX() public method

Create auxiliary data like a column in the MetaModel table or references in another table etc.
public destroyAUX ( ) : void
return void

getFilterOptions() public method

{@inheritDoc}
public getFilterOptions ( $idList, $usedOnly, &$arrCount = null )

getSQLDataType() public method

In this base class a sane value of "blob" allowing NULL is used. Deriving classes SHOULD override this function.
public getSQLDataType ( ) : string
return string 'blob NULL'

handleMetaChange() public method

This tells the attribute to perform any actions that must be done to correctly initialize the new value and to perform any action to undo the changes that had been done for the previous value. i.e.: when an attribute type needs columns in an an auxiliary table, these will have to be updated herein. This method may throw an exception, when the new value is invalid or any problems appear, the MetaModelAttribute will then keep the old meta value.
public handleMetaChange ( string $strMetaName, mixed $varNewValue ) : MetaModels\Attribute\IAttribute
$strMetaName string Name of the meta information that shall be updated.
$varNewValue mixed The new value for this meta information.
return MetaModels\Attribute\IAttribute The instance of this attribute, to support chaining.

initializeAUX() public method

Delete all auxiliary data like a column in the MetaModel table or references in another table etc.
public initializeAUX ( ) : void
return void

renameColumn() public method

Renames the underlying database structure for this field.
public renameColumn ( string $strNewColumnName ) : void
$strNewColumnName string The new column name.
return void

searchFor() public method

Base implementation, perform string matching search. The standard wildcards * (many characters) and ? (a single character) are supported.
public searchFor ( string $strPattern ) : int[]
$strPattern string The text to search for. This may contain wildcards.
return int[] the ids of matching items.

serializeData() public method

Take the unserialized data and serialize it for the native DB column.
public serializeData ( mixed $value ) : string
$value mixed The input value.
return string

setDataFor() public method

This method is called to store the data for certain items to the database.
public setDataFor ( mixed $arrValues ) : void
$arrValues mixed The values to be stored into database. Mapping is item id=>value.
return void

sortIds() public method

This base implementation does a plain SQL sort by native value as defined by MySQL.
public sortIds ( $idList, $strDirection )

unserializeData() public method

Take the raw data from the DB column and unserialize it.
public unserializeData ( string $value ) : mixed
$value string The input value.
return mixed