Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Piwik_ViewDataTable: $this->dataTable->getFirstRow() returns false and attempts to access getColumns() #820

Closed
anonymous-piwik-user opened this Issue · 1 comment

2 participants

Anonymous Piwik user Anthon Pang
Anonymous Piwik user

If empty result set you cannot retrieve the columns, see modified code below

        /**
         * Returns columns names to display, in order.
         * If no columns were specified to be displayed, return all columns found in the first row.
         * @param array PHP array conversion of the data table
         * @return array
         */
        public function getColumnsToDisplay()
        {
                if(empty($this->columnsToDisplay))
                {
                        $row = $this->dataTable->getFirstRow();
                        if (empty($row))
                                return array();

                        return array_keys($row->getColumns());
                }
                $this->columnsToDisplay = array_filter($this->columnsToDisplay);
                return $this->columnsToDisplay;
        }
Anthon Pang
Collaborator

(In [1245]) fixes #820

Anonymous Piwik user anonymous-piwik-user added this to the Piwik 0.4.1 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.