summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgor <egor.26.93@gmail.com>2015-07-27 22:35:25 +0300
committerEgor <egor.26.93@gmail.com>2015-07-27 22:35:25 +0300
commit0947d0e30dbcea775e1026586503744034d8cf1a (patch)
tree4e61b48e7ab29637333045254c58c781ac2b3f56
parent63e9839e0a76e44607d248f31e15aaae97943d18 (diff)
downloadscheduler-helper-php-0947d0e30dbcea775e1026586503744034d8cf1a.zip
scheduler-helper-php-0947d0e30dbcea775e1026586503744034d8cf1a.tar.gz
scheduler-helper-php-0947d0e30dbcea775e1026586503744034d8cf1a.tar.bz2
Updated filtering fields of recurring events.
-rwxr-xr-xSchedulerHelper.php9
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: