Back to CMSHelper class

Method getRowData

public array
getRowData
(\Joomla\CMS\Table\TableInterface $table)
Gets a row of data from a table
Parameters
  • \Joomla\CMS\Table\TableInterface $table Table instance for a row.
Returns
  • array Associative array of all columns and values for a row in a table.
Since
  • 3.2
Class: CMSHelper
Project: Joomla

Method getRowData - Source code

/**
 * Gets a row of data from a table
 *
 * @param   TableInterface  $table  Table instance for a row.
 *
 * @return  array  Associative array of all columns and values for a row in a table.
 *
 * @since   3.2
 */
public function getRowData(TableInterface $table)
{
    $fields = $table->getFields();
    $data = array();
    foreach ($fields as &$field) {
        $columnName = $field->Field;
        $value = $table->{$columnName};
        $data[$columnName] = $value;
    }
    return $data;
}