table, use parse to from|update|delete|other table name
@param  array $data
@return array
332145
protected function _parseDataToTable($data)
    {   
        
        $values = array();
        if (is_scalar($data)) {             // 1 scalar
            preg_match('/(.*)(\,|left\sjoin|inner\sjoin)+(.*)/i', $data, $matches);
            if ($matches) {
                $temp1 = $this->_parseDataToTable($matches[1]);
                $temp2 = $this->_parseDataToTable($matches[3]);
                $values[] = $temp1[0] . ' ' . $matches[2] . ' ' . $temp2[0];
            } else {
                $values[] = $this->formatTableName($data);
            }
        } elseif (is_array($data)) {        // 2 array
            foreach ($data as $key => $value) {
                
                if ((is_numeric($key) || empty($key)) && $value) {
                    $temp = $this->_parseDataToTable($value);
                    $values = array_merge($values, $temp);
                }
            }
        }
        
        return $values;
    }
1076176
public function map($data)
    {
        $data = $this->parseToArray($data);
        $this->clearDynamic($data);

        // Parse each specified field
        foreach ($this->schema->fields as $key => $fieldType) {
            $data[$key] = $this->parseField($data[$key] ?? null, $fieldType);
        }

        return $data;
    }
454917
public static function fromArray(array $data)
    {
        $iniSections = IniParser::i()->parseArray($data);

        return self::fromIniSections($iniSections);
    }
194987
public function updateTranslation(array $data)
    {
        $translation = $this->translations()->where([
            'record_id' => $this->id,
            'language_code' => Arr::get($data, 'language_code'),
        ])->first();

        if (is_null($translation)) {
            $translation = $this->translations()->create($data);
        } else {
            $translation->update($data);
        }

        return $translation;
    }
79609
public static function storeEditableCmsTable($table, array $data): array
    {
        $res = ['add' => 0, 'update' => 0, 'delete' => 0];

        // Field to be updated
        if (isset($data['update']) && \is_array($data['update'])) {
            foreach ($data['update'] as $id => $v) {
                $res['update'] += self::update($table, $v, $id);
            }
        }

        // Delete fields
        if (isset($data['delete']) && \is_array($data['delete'])) {
            foreach ($data['delete'] as $v) {
                $res['delete'] += self::getInstance()->delete($table, $v);
            }
        }

        // Same as deleted
        if (isset($data['remove']) && \is_array($data['remove'])) {
            foreach ($data['remove'] as $v) {
                $res['delete'] += self::getInstance()->delete($table, $v);
            }
        }

        // Create new fields
        if (isset($data['add']) && \is_array($data['add'])) {
            foreach ($data['add'] as $v) {
                $res['add'] += self::add($table, $v);
            }
        }

        return $res;
    }
83608
public function takeData($data)
    {
        $keyColumn = $this->getKeyColumn();
        if (array_key_exists($keyColumn, $data) && is_array($data[$keyColumn])) {
            foreach ($data[$keyColumn] as $recPos => $recordKey) {
                if (substr($recordKey, 0, 4) == 'ext:') {
                    $data['external-ids'][] = $recordKey;
                    unset($data[$keyColumn][$recPos]);
                }
            }
            if (count($data[$keyColumn]) == 1) {
                $data[$keyColumn] = current($data[$keyColumn]);
            }
        }
        $result = parent::takeData($data);

        if (array_key_exists($keyColumn, $data) || array_key_exists('kod', $data)) {
            $this->updateApiURL();
        }

        return $result;
    }
701571
public function replace(array $data)
    {
        $data = &$this->loadFilterData($data);
        if ( $data == false ) {
            return false;
        }
        if ( !isset($data[$this->primaryKey]) && $this->autoPrimary ) {
            $data[$this->primaryKey] = StringUtils::genGlobalUid();
        }
        $result = $this->db->replace($this->table, $data);

        return $result;
    }
1250362
public function update($table = '', $data = [], $arrayWhere = [], $other = '')
    {
        // if table name is empty
        if (!empty($table)) {
            // check if array data and where array is more then 0
            if (count($data) > 0 && count($arrayWhere) > 0) {
                // parse array data and make a temp array
                $tmp = [];
                foreach ($data as $k => $v) {
                    $tmp[] = "$k = :s_$k";
                }
                // join temp array value with ,
                $sFields = implode(', ', $tmp);
                // delete temp array from memory
                unset($tmp);

                $tmp = [];
                // parse where array and store in temp array
                foreach ($arrayWhere as $k => $v) {
                    $tmp[] = "$k = :s_$k";
                }

                $this->data = $data;
                $this->arrayWhere = $arrayWhere;
                // join where array value with AND operator and create where condition
                $where = implode(' AND ', $tmp);
                // unset temp array
                unset($tmp);
                // make sql query to update
                $this->sql = "UPDATE `$table` SET $sFields WHERE $where $other;";
                // on PDO prepare statement
                $this->STH = $this->prepare($this->sql);
                // bind pdo param for update statement
                $this->_bindPdoNameSpace($data);
                // bind pdo param for where clause
                $this->_bindPdoNameSpace($arrayWhere);
                // try catch block start
                try {
                    // if PDO run
                    if ($this->STH->execute()) {
                        // get affected rows
                        $this->affectedRows = $this->STH->rowCount();
                        // close PDO
                        $this->STH->closeCursor();
                        // return self object
                        return $this;
                    } else {
                        self::error($this->STH->errorInfo());
                    }
                } catch (\PDOException $e) {
                    // get pdo error and pass on error method
                    self::error($e->getMessage() . ': ' . __LINE__);
                } // try catch block end
            } else {
                self::error('update statement not in valid format..');
            }
        } else {
            self::error('Table name not found..');
        }
    }
242003
public function update($q, $data)
    {
        $q['table'] = $this->table;
        return $this->db->update($q, $data);
    }
855328
private function filterData(array $data)
    {
        $pattern = '/^' . str_replace('%', '.*', trim($this->likeExpr, "'")) . '$/';
        $newData = [];

        foreach ($data as $row) {
            if (preg_match($pattern, $row['Name'])) {
                $newData[] = $row;
            }
        }

        return $newData;
    }
1269249
private function getChanges(array $data)
    {
        $changes = [
            'inserted' => Arr::dot($data),
            'updated'  => [],
            'deleted'  => [],
        ];

        foreach ($this->newQuery()->pluck($this->keyColumn) as $key) {
            if (Arr::has($changes['inserted'], $key))
                $changes['updated'][$key] = $changes['inserted'][$key];
            else
                $changes['deleted'][] = $key;

            Arr::forget($changes['inserted'], $key);
        }

        return $changes;
    }
627088
public function getQueryData($table, array $data)
    {
        $columns = $this->getSchemaManager()->listTableColumns($table);

        $allColumnTypes = $this->getColumnTypes($table);
        $columnTypes = [];
        foreach ($columns as $column) {
            $columnName = $column->getName();
            if (\array_key_exists($columnName, $data)) {
                $columnTypes[$this->connection->quoteIdentifier($columnName)] = $allColumnTypes[$columnName];
            }
        }

        $quotedData = [];
        foreach ($data as $column => $value) {
            $quotedColumn = $this->connection->quoteIdentifier($column);
            if (\array_key_exists($quotedColumn, $columnTypes)) {
                $quotedData[$quotedColumn] = $value;
            }
        }

        \ksort($quotedData);
        \ksort($columnTypes);

        return new QueryData(
            $this->connection->quoteIdentifier($table),
            $quotedData,
            \array_values($columnTypes)
        );
    }
495472
public function updateTranslation(array $data)
    {
        $translations = $this->translations()->where([
            'record_id'     => $this->id,
            'language_code' => array_get($data, 'language_code'),
        ])->first();

        if (is_null($translations))
            $translations = $this->translations()->create($data);
        else
            $translations->update($data);

        return $translations;
    }
971496
protected function _update(array $data)
    {
        $data = $this->_setData($data);
        $pmk = $this->getPrimaryKey();
        unset($data[$pmk]);
        $sql = Sql::createSql($this->getAdapter())->update($this->getTableName());
        $event = new Save([
            'action' => Save::UPDATE,
            'data' => $data,
            'abort' => false
        ]);
        $this->getEventManager()->trigger(Save::BEFORE_SAVE, $this, $event);
        if ($event->abort) {
            return false;
        }
        $sql->set($event->data)
            ->where(["{$pmk} = :id" => [':id' => $this->$pmk]])
            ->execute();
        $this->getEventManager()->trigger(Save::AFTER_SAVE, $this, $event);
        return true;
    }
178655
public function update_all($data)
    {
        $data = $this->trigger('before_update', $data);
        $result = $this->_database->set($data)
                           ->update($this->_table);
        $this->trigger('after_update', array($data, $result));

        return $result;
    }
800675
public function update($table, array $data = [])
    {
        /**
         * Flatten data for possible multivalued values like geometric POINT or so.
         */
        $cache = $this->repository->getCache();
        foreach ($data as $key => &$val) {
            if (is_array($val)) {
                if ($cache->tableHasField($table, $key) && $cache->getField($key, $table)['type'] == 'point') {
                    $val = new Raw('GeomFromText(\'POINT(' . (float)$val[0] . ' ' . (float)$val[1] . ')\')');
                }
            }
        }

        /**
         * We will update record in $table with $data ...
         */
        $query = (new Update())->setTable($table)->setSet($data);

        /**
         * ... add primary key condition ...
         */
        $query->primaryWhere($this->entity, $data, $table);

        /**
         * ... prepare query ...
         */
        $prepare = $this->repository->prepareQuery($query, null);

        /**
         * ... and execute it.
         */
        $this->repository->executePrepared($prepare);

        /**
         * Return number of updated records.
         */
        return $prepare->rowCount();
    }
1036201
private function cleanData(array $data) : array
  {
    foreach($data as $key => $value) {
      $data[$key] = $this->replace($key, $value);
    }

    return $data;
  }