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
Afficher le fichier Open project: metamodels/core Class Usage Examples

Méthodes publiques

Méthode 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 méthode

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

deleteColumn() public méthode

Removes the underlying database structure for this field.
public deleteColumn ( ) : void
Résultat void

destroyAUX() public méthode

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

getFilterOptions() public méthode

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

getSQLDataType() public méthode

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

handleMetaChange() public méthode

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.
Résultat MetaModels\Attribute\IAttribute The instance of this attribute, to support chaining.

initializeAUX() public méthode

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

renameColumn() public méthode

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

searchFor() public méthode

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.
Résultat int[] the ids of matching items.

serializeData() public méthode

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

setDataFor() public méthode

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.
Résultat void

sortIds() public méthode

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

unserializeData() public méthode

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