/** * Inits the finisher mapping settings values to internal attributes. * * @return void */ public function init($gp, $settings) { parent::init($gp, $settings); //set table $this->table = $this->utilityFuncs->getSingle($this->settings, 'table'); if (!$this->table) { $this->utilityFuncs->throwException('no_table', 'Tx_Formhandler_Finisher_DB'); return; } if (!is_array($this->settings['fields.'])) { $this->utilityFuncs->throwException('no_fields', 'Tx_Formhandler_Finisher_DB'); return; } //set primary key field $this->key = $this->utilityFuncs->getSingle($this->settings, 'key'); if (strlen($this->key) === 0) { $this->key = 'uid'; } //check whether to update or to insert a record $this->doUpdate = FALSE; if (intval($this->utilityFuncs->getSingle($this->settings, 'updateInsteadOfInsert')) === 1) { //check if uid of record to update is in GP $uid = $this->getUpdateUid(); $andWhere = $this->utilityFuncs->getSingle($this->settings, 'andWhere'); $recordExists = $this->doesRecordExist($uid, $andWhere); if ($recordExists) { $this->doUpdate = TRUE; } elseif (intval($this->utilityFuncs->getSingle($this->settings, 'insertIfNoUpdatePossible')) !== 1) { $this->utilityFuncs->debugMessage('no_update_possible', array(), 2); } } }
/** * Inits the finisher mapping settings values to internal attributes. * * @return void */ public function init($gp, $settings) { parent::init($gp, $settings); //set table $this->table = $this->settings['table']; if (!$this->table) { Tx_Formhandler_StaticFuncs::throwException('no_table', 'Tx_Formhandler_Finisher_DB'); return; } if (!is_array($this->settings['fields.'])) { Tx_Formhandler_StaticFuncs::throwException('no_fields', 'Tx_Formhandler_Finisher_DB'); return; } //set primary key field $this->key = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'key'); if (strlen($this->key) === 0) { $this->key = 'uid'; } //check whether to update or to insert a record $this->doUpdate = FALSE; if ($this->settings['updateInsteadOfInsert']) { $this->doUpdate = TRUE; } }
/** * Method to set GET/POST for this class and load the * configuration * * @param array The GET/POST values * @param array The TypoScript configuration * @return void */ public function init($gp, $settings) { parent::init($gp, $settings); }