/** * This transform function is called before the saving of the data in the source model and allows you to * change all data. * * @param \MUtil_Model_ModelAbstract $model The parent model * @param array $row Array containing row * @return array Row array containing (optionally) transformed data */ public function transformRowBeforeSave(\MUtil_Model_ModelAbstract $model, array $row) { if (!$this->tracker) { $this->tracker = $this->loader->getTracker(); } if (isset($row[$this->respTrackIdField]) && $row[$this->respTrackIdField]) { $respTrack = $this->tracker->getRespondentTrack($row[$this->respTrackIdField]); $fields = $respTrack->processFieldsBeforeSave($row); $row['gr2t_track_info'] = $this->fieldsDefinition->calculateFieldsInfo($fields); // Also save the calculated fields into the row (actual save is in transformRowAfterSave) return $fields + $row; } return $row; }
/** * * @return \Gems_Tracker_RespondentTrack */ public function getRespondentTrack() { if (!$this->respTrack) { $this->respTrack = $this->tracker->getRespondentTrack($this->_gemsData['gto_id_respondent_track']); } return $this->respTrack; }