public function update($table, $row, $identifier = [])
    {
        if (!array_key_exists($table, $this->rows)) {
            $this->loadTable($table);
        }

        $data = $this->sanitiseRow($table, $row);

        if (empty($identifier) && isset($data['id'])) {
            $identifier = ['id' => $data['id']];
        }

        $rows = [];

        foreach ($this->rows[$table] as $key => $row) {
            if ($this->match($row, $identifier)) {
                $rows[] = $key;
            }
        }

        if (empty($rows)) {
            throw new \RuntimeException("No matching entry found in {$table}.csv");
        }

        foreach ($rows as $key) {
            foreach ($data as $field => $value) {
                $this->rows[$table][$key][$field] = $value;
            }
        }
    }
public function update($table, $row, $identifier = [])
    {
        if (!array_key_exists($table, $this->rows)) {
            $this->loadTable($table);
        }

        $data = $this->sanitiseRow($table, $row);

        if (empty($identifier) && isset($data['id'])) {
            $identifier = ['id' => $data['id']];
        }

        $rows = [];

        foreach ($this->rows[$table] as $key => $row) {
            if ($this->match($row, $identifier)) {
                $rows[] = $key;
            }
        }

        if (empty($rows)) {
            throw new \RuntimeException("No matching entry found in {$table}.csv");
        }

        foreach ($rows as $key) {
            foreach ($data as $field => $value) {
                $this->rows[$table][$key][$field] = $value;
            }
        }
    }
public function update ( $ table , $ row , $ identifier = [ ] ) { if ( ! array_key_exists ( $ table , $ this -> rows ) ) { $ this -> loadTable ( $ table ) ; } $ data = $ this -> sanitiseRow ( $ table , $ row ) ; if ( empty ( $ identifier ) && isset ( $ data [ 'id' ] ) ) { $ identifier = [ 'id' => $ data [ 'id' ] ] ; } $ rows = [ ] ; foreach ( $ this -> rows [ $ table ] as $ key => $ row ) { if ( $ this -> match ( $ row , $ identifier ) ) { $ rows [ ] = $ key ; } } if ( empty ( $ rows ) ) { throw new \ RuntimeException ( "No matching entry found in {$table}.csv" ) ; } foreach ( $ rows as $ key ) { foreach ( $ data as $ field => $ value ) { $ this -> rows [ $ table ] [ $ key ] [ $ field ] = $ value ; } } }
Updates an entity in the storage

@param   string $table      The name of the table
@param   array  $row        The data row
@param   array  $identifier key-value pairs to identify the record(s)

@return  void
Updates an entity in the storage