FORMidable RAD Framework

tx_dhdbmm Class Reference

Inheritance diagram for tx_dhdbmm:

Inheritance graph
Collaboration diagram for tx_dhdbmm:

Collaboration graph
List of all members.

Public Member Functions

 _doTheMagic ($bShouldProcess=TRUE)
 _getStoredData ($sName=false)
 _retrieveMmFields ()
 _extractMmRelationsFromFormData (&$formData)
 _storeMmRelations ($uid)

Public Attributes

 $mmFields = null

Detailed Description

Class 'tx_seminars' for the 'seminars' extension. This naming scheme needs to be followed due to the naming conventions imposed by FORMidable.

This is a FORMidable data handler that can also handle m:n relations.

Oliver Klee <>

Definition at line 36 of file class.tx_dhdbmm.php.

Member Function Documentation

tx_dhdbmm::_doTheMagic ( bShouldProcess = TRUE  ) 

Takes the entered form data and inserts/updates it in the DB, using the table name set in /control/datahandler/tablename. For fields that have a m:n table defined in $this->mmFields, a real m:n relation is created instead of a comma-separated list of foreign keys.

This function can insert new records and update existing records.

This function is an exact copy of tx_dhdb with the following calls added:

boolean whether the data should be processed at all

Reimplemented from tx_dhdb.

Definition at line 69 of file class.tx_dhdbmm.php.

References formidable_mainobject::$oForm, formidable_maindatahandler::_allIsValid(), formidable_maindatahandler::_currentEntryId(), _extractMmRelationsFromFormData(), formidable_maindatahandler::_getFlatFormDataManaged(), tx_dhdb::_processBeforeInsertion(), _storeMmRelations(), formidable_maindatahandler::keyName(), and formidable_maindatahandler::tableName().

tx_dhdbmm::_getStoredData ( sName = false  ) 

Retrieves the data of the current record from the DB as an associative array. m:n relations are returned as a comma-separated list of UIDs.

This function calls _retrieveMmFields, so there is no need to call it before calling this function.

boolean (not sure what this is, but FORMidable 0.7.0 has it)
array data from the DB as an associative array

Reimplemented from tx_dhdb.

Definition at line 151 of file class.tx_dhdbmm.php.

References formidable_maindatahandler::_currentEntryId(), and _retrieveMmFields().

tx_dhdbmm::_retrieveMmFields (  ) 

Retrieves the keys and MM table names for m:n relations as key/value pairs and stores them in $this->mmFields in the following form:

field key => name of the m:n table

The data will be retrieved from the datahandler in the XML file where it needs to be stored in the following format:

<mmrelations> <relation field="place" mmtable="tx_seminars_seminars_place_mm"> <relation field="speakers" mmtable="tx_seminars_seminars_speakers_mm"> </mmrelations>

If $this->mmFields has already been set, this function will be a no-op.


Definition at line 202 of file class.tx_dhdbmm.php.

Referenced by _extractMmRelationsFromFormData(), and _getStoredData().

tx_dhdbmm::_extractMmRelationsFromFormData ( &$  formData  ) 

Iterates over the form data in $formData and processes the fields that are marked as m:n relations the following way: 1. For each entry in the comma-separated list of values, an element in $this->mmInserts is created. 2. The comma-separated list will be converted to an integer containing the number of relations for this field.

This function calls _retrieveMmFields, so there is no need to call it before calling this function.

After this function has been called, $this->mmInsersts will not be null, but might be empty.

array the current form data (must not be empty or null), will be modified

Definition at line 243 of file class.tx_dhdbmm.php.

References _retrieveMmFields().

Referenced by _doTheMagic().

tx_dhdbmm::_storeMmRelations ( uid  ) 

Takes the m:n relations stored in $this->mmInserts and stores them in the DB with $uid as the local key. All previous relations for that key will be removed.

Before this function may be called, _extractMmRelationsFromFormData() must have been called.

integer the uid of the current record, must be > 0

Definition at line 287 of file class.tx_dhdbmm.php.

Referenced by _doTheMagic().

Member Data Documentation

tx_dhdbmm::$mmFields = null

list of fields that are m:n relations as key/mm-table pairs

Definition at line 38 of file class.tx_dhdbmm.php.


Array containing the data to insert into m:n tables using the following format for each element:

'table' => name of the m:n table, 'data' => array( 'sorting' => the sorting position, 'uid_foreign' => the foreign key )

Definition at line 50 of file class.tx_dhdbmm.php.

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

Généré par L'expert TYPO3 avec  doxygen 1.4.6