Exemple #1
0
 /**
  * @param array $entry
  *
  * @return integer
  */
 public function processEntry(array $entry)
 {
     $configuration = $this->getConfiguration();
     $mapping = $configuration['mapping'];
     $insertFields = [];
     foreach ($mapping as $key => $value) {
         $insertFields[$value] = $entry[$key];
     }
     $insertFields['pid'] = $configuration['pid'];
     Utility::getDatabaseConnection()->exec_INSERTquery($configuration['table'], $insertFields);
     return TargetInterface::RESULT_INSERT;
 }
 /**
  * Update a record in the target table which you have specified in the
  * target section of the strategy (don't update the password)
  *
  * @param array $entry
  *
  * @return void
  */
 protected function updateRecord(array $entry)
 {
     $into_table = $this->getConfiguration()['target_table'];
     $fieldName = $this->getConfiguration()['mapping'][$this->identifierField];
     $whereStatement = "pid = '" . $this->getConfiguration()['pid'] . "' AND " . $fieldName . " = '" . $entry[$this->identifierField] . "'";
     $tmp_arr = [];
     foreach ($this->getConfiguration()["mapping"] as $key => $value) {
         $tmp_arr[$value] = $entry[$key];
     }
     $field_values = $this->duplicateArray($tmp_arr, $this->getConfiguration()['exclude_from_update']);
     $field_values['tstamp'] = time();
     Utility::getDatabaseConnection()->exec_UPDATEquery($into_table, $whereStatement, $field_values);
 }