diff options
-rwxr-xr-x | SchedulerHelper.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/SchedulerHelper.php b/SchedulerHelper.php index 8ec5694..df5888f 100755 --- a/SchedulerHelper.php +++ b/SchedulerHelper.php @@ -34,6 +34,7 @@ abstract class DHelper extends SchedulerHelperConnector "debug" => true ); + protected $_mapped_fields = array(); protected function getIdFieldName() { return $this->getFieldsNames(self::FLD_ID); @@ -96,6 +97,8 @@ abstract class DHelper extends SchedulerHelperConnector if(!is_array($fieldsDataArray)) throw new Exception("Fields data must be array."); + $this->_mapped_fields = $fieldsDataArray; + foreach($fieldsDataArray as $fieldKey => $fieldValue) { //If field name is numeric, then made same field key and field value. if(is_numeric($fieldKey)) @@ -266,12 +269,16 @@ class Helper extends DHelper implements IHelper { $filteredEventData = array(); foreach($eventDataArray as $dataKey => $dataValue) { + $mappedFieldsValues = array_flip($this->_mapped_fields); switch($dataKey) { case $this->getIdFieldName(): case $this->getRecurringTypeFieldName(): case $this->getParentIdFieldName(): case $this->getLengthFieldName(): - continue; + if(!array_key_exists($dataKey, $mappedFieldsValues)) + continue; + + $filteredEventData[$dataKey] = $dataValue; break; default: |