public function formatQueryResult(QueryResultInterface $result, OutputInterface $output, $elapsed)
    {
        $table = new Table($output);
        $table->setHeaders(array_merge([
            'Path',
        ], $result->getColumnNames()));

        foreach ($result->getRows() as $row) {
            $values = array_merge([
                $row->getPath(),
            ], $row->getValues());

            foreach ($values as &$value) {
                if ($value instanceof \DateTime) {
                    $value = $value->format('c');
                    continue;
                }

                $value = $this->textHelper->truncate($value, 255);
            }

            $table->addRow($values);
        }

        $table->render($output);

        if (true === $this->config['show_execution_time_query']) {
            $output->writeln(sprintf(
                '%s rows in set (%s sec)',
                count($result->getRows()),
                number_format($elapsed, $this->config['execution_time_expansion']))
            );
        }
    }
public function formatQueryResult(QueryResultInterface $result, OutputInterface $output, $elapsed)
    {
        $table = new Table($output);
        $table->setHeaders(array_merge([
            'Path',
        ], $result->getColumnNames()));

        foreach ($result->getRows() as $row) {
            $values = array_merge([
                $row->getPath(),
            ], $row->getValues());

            foreach ($values as &$value) {
                if ($value instanceof \DateTime) {
                    $value = $value->format('c');
                    continue;
                }

                $value = $this->textHelper->truncate($value, 255);
            }

            $table->addRow($values);
        }

        $table->render($output);

        if (true === $this->config['show_execution_time_query']) {
            $output->writeln(sprintf(
                '%s rows in set (%s sec)',
                count($result->getRows()),
                number_format($elapsed, $this->config['execution_time_expansion']))
            );
        }
    }
public function formatQueryResult ( QueryResultInterface $ result , OutputInterface $ output , $ elapsed ) { $ table = new Table ( $ output ) ; $ table -> setHeaders ( array_merge ( [ 'Path' , ] , $ result -> getColumnNames ( ) ) ) ; foreach ( $ result -> getRows ( ) as $ row ) { $ values = array_merge ( [ $ row -> getPath ( ) , ] , $ row -> getValues ( ) ) ; foreach ( $ values as & $ value ) { if ( $ value instanceof \ DateTime ) { $ value = $ value -> format ( 'c' ) ; continue ; } $ value = $ this -> textHelper -> truncate ( $ value , 255 ) ; } $ table -> addRow ( $ values ) ; } $ table -> render ( $ output ) ; if ( true === $ this -> config [ 'show_execution_time_query' ] ) { $ output -> writeln ( sprintf ( '%s rows in set (%s sec)' , count ( $ result -> getRows ( ) ) , number_format ( $ elapsed , $ this -> config [ 'execution_time_expansion' ] ) ) ) ; } }
Render a table with the results of the given QueryResultInterface.
Render a table with the results of the given QueryResultInterface .