Add a separate row to a file
@param array $row a row in the model
@param file $file The already opened file
334511
public function addRow($row, $file)
    {
        $exportRow = $this->filterRow($row);
        $labeledCols = $this->getLabeledColumns();
        $exportRow = array_replace(array_flip($labeledCols), $exportRow);
        $changed = false;
        foreach ($exportRow as $name => $value) {
            $type = $this->model->get($name, 'type');
            // When numeric, there could be a non numeric answer, just ignore empty values
            if ($type == \MUtil_Model::TYPE_NUMERIC && !empty($value) && !is_numeric($value)) {
                $this->model->set($name, 'type', \MUtil_Model::TYPE_STRING);
                $changed = true;
            }
        }
        fputcsv($file, $exportRow, $this->delimiter, '"');
        if ($changed) {
            if ($this->batch) {
                $this->batch->setVariable('model', $this->model);
            } else {
                $this->_session->model = $this->model;
            }
        }
    }
236638
public function container(Column\Container $column, array $row) {

        $html = '';
        foreach($column->getColumns() as $c) {
            /** @var Column\Column $c */
            $html .= $c->render($row) . PHP_EOL;
        }

        return $this->post($html, $column, $row);
    }
345557
public function add($row = array())
    {
        //Argument 1 must be an array or Eden_Model
        Argument::i()->test(1, 'array', $this->model);
        
        //if it's an array
        if (is_array($row)) {
            //make it a model
            $model = trim(str_replace('\\', '_', $this->model), '_');
            $row = $this->$model($row);
        }
        
        if (!is_null($this->database)) {
            $row->setDatabase($this->database);
        }
        
        if (!is_null($this->table)) {
            $row->setTable($this->table);
        }
        
        //add it now
        $this->list[] = $row;
        
        return $this;
    }
362533
public function addRow(GridRow $row)
    {
        if (!$this->rows->contains($row)) {
            $this->rows->add($row);
            $row->setQuestion($this);
        }
    }
1296845
public function insertFile($file)
    {
        if ( ! $this->checkedIndexes) {
            $this->ensureIndexes();
        }

        $this->filesCollection->insertOne($file);
    }
867144
public function addRow($rows = null) {
        if( ! is_array($rows) ) {
            $rows = func_get_args();
        }
        $row = new TableRow;
        foreach( $rows as $arg ) {
            $cell = new TableCell;
            $cell->addChild( $arg );
            $row->addChild( $cell );
        }
        $this->addChild($row);
        return $row;
    }
712899
public function init($file, array $data = null)
    {
        if ($data === null) {
            $data = $this->setJsonDefaults([]);
        }
        $this->app['filesystem']->write($file, Json::dump($data, Json::HUMAN));
    }
839827
public function add_data($row) {
        if(!isset($this->path)) {
            $this->set_temp_file_path();
            $this->fp = fopen($this->path, 'w+');
        }
        $delimiter = csv_import_reader::get_delimiter($this->delimiter);
        fputcsv($this->fp, $row, $delimiter, $this->csvenclosure);
    }
111407
private function insertWordIntoRow($word, $row, $col)
    {
        $this->wordList->add($word, ($row + 1), (1 + $col));

        $wordArray = Utils::stringToArray($word);

        foreach ($wordArray as $letter) {
            $this->grid[$row][$col] = $letter;
            $col++;
        }
    }
221395
public function add_stored_file($file) {
        if (is_numeric($file)) {
            $this->files[$file] = $file;
        } else {
            $this->files[$file->get_id()] = $file;
        }
    }
1309044
public function load(string $file, array $data = null): void
    {
        if ($data != null) {
            extract($data);
        }
        include $file;
    }
304279
protected function _addRow(PHPExcel $phpexcel, array $row, $rowIndex) {
        $col = 0;
        foreach ($row as $key => $value) {
            $colIndex = $col++;
            if (is_array($value)) {
                $rowset = $value;
                $value = array();
                foreach ($rowset as $row) {
                    if (is_array($row)) {
                        $values = array_values($row);
                        $values = implode(' : ', $values);
                    } else {
                        $values = $row;
                    }
                    $value[] = $values;
                }
                $value = implode("\n", $value);
            }
            $phpexcel->getActiveSheet()->setCellValueByColumnAndRow($colIndex, $rowIndex, $value);
        }
    }
1056001
private function doUpdateByQueries(array $row): void
    {
        $data = $this->generateFakeData();

        $queryBuilder = $this->dbUtils->getConn()->createQueryBuilder();
        $queryBuilder = $queryBuilder->update($this->entity);
        foreach ($data as $field => $value) {
            $value = empty($row[$field]) ?
                $this->dbUtils->getEmptyValue($this->entityCols[$field]['type']) :
                $value;

            $condition = $this->dbUtils->getCondition($field, $this->entityCols[$field]);
            $queryBuilder = $queryBuilder->set($field, $condition);
            $queryBuilder = $queryBuilder->setParameter(":$field", $value);
        }
        $queryBuilder = $queryBuilder->where("{$this->priKey} = :{$this->priKey}");
        $queryBuilder = $queryBuilder->setParameter(":{$this->priKey}", $row[$this->priKey]);

        $this->returnRes === true ?
            array_push($this->queries, $this->dbUtils->getRawSQL($queryBuilder)) :
            null;

        if ($this->pretend === false) {
            $queryBuilder->execute();
        }
    }
687522
protected function add_data_for_external($row) {
        $this->dataforexternal[] = [
            'id' => $row->id,
            'courseid' => $row->courseid,
            'userid' => $row->userid,
            'fullname' => fullname($row),
            'timemodified' => $row->completed_timemodified,
            'responses' => $this->get_responses_for_external($row),
        ];
    }
801011
public function row( array $row ) {

		$extra_row_count = 0;

		if ( count( $row ) > 0 ) {
			$extra_rows = array_fill( 0, count( $row ), array() );

			foreach( $row as $col => $value ) {

				$value = str_replace( array( "\r\n", "\n" ), ' ', $value );

				$col_width = $this->_widths[ $col ];
				$encoding = function_exists( 'mb_detect_encoding' ) ? mb_detect_encoding( $value, null, true /*strict*/ ) : false;
				$original_val_width = Colors::width( $value, self::isPreColorized( $col ), $encoding );
				if ( $col_width && $original_val_width > $col_width ) {
					$row[ $col ] = \cli\safe_substr( $value, 0, $col_width, true /*is_width*/, $encoding );
					$value = \cli\safe_substr( $value, \cli\safe_strlen( $row[ $col ], $encoding ), null /*length*/, false /*is_width*/, $encoding );
					$i = 0;
					do {
						$extra_value = \cli\safe_substr( $value, 0, $col_width, true /*is_width*/, $encoding );
						$val_width = Colors::width( $extra_value, self::isPreColorized( $col ), $encoding );
						if ( $val_width ) {
							$extra_rows[ $col ][] = $extra_value;
							$value = \cli\safe_substr( $value, \cli\safe_strlen( $extra_value, $encoding ), null /*length*/, false /*is_width*/, $encoding );
							$i++;
							if ( $i > $extra_row_count ) {
								$extra_row_count = $i;
							}
						}
					} while( $value );
				}

			}
		}

		$row = array_map(array($this, 'padColumn'), $row, array_keys($row));
		array_unshift($row, ''); // First border
		array_push($row, ''); // Last border

		$ret = join($this->_characters['border'], $row);
		if ( $extra_row_count ) {
			foreach( $extra_rows as $col => $col_values ) {
				while( count( $col_values ) < $extra_row_count ) {
					$col_values[] = '';
				}
			}

			do {
				$row_values = array();
				$has_more = false;
				foreach( $extra_rows as $col => &$col_values ) {
					$row_values[ $col ] = array_shift( $col_values );
					if ( count( $col_values ) ) {
						$has_more = true;
					}
				}

				$row_values = array_map(array($this, 'padColumn'), $row_values, array_keys($row_values));
				array_unshift($row_values, ''); // First border
				array_push($row_values, ''); // Last border

				$ret .= PHP_EOL . join($this->_characters['border'], $row_values);
			} while( $has_more );
		}
		return $ret;
	}
1272365
public InsertIntoTable addRowsFrom(File file, FileParser fileParser) {
    builder.addRowsFrom(file, fileParser);
    return this;
  }
21885
public function addFile($file)
    {
        if (is_string($file)) {
            $file = array($file);
        }

        if (is_array($file)) {
            foreach ($file as $name) {
                if (!isset($this->_files[$name]) && !empty($name)) {
                    $this->_files[$name] = $name;
                }
            }
        }

        return $this;
    }