public function toArray($assoc=false)
    {
        $data = array(
            'name' => $this->_name,
            'comment' => $this->getComment(),
        );
        foreach ($this->_columns as $name => $column) {
            if ($assoc) {
                $data['columns'][$name] = $column->toArray();
            } else {
                $data['columns'][] = $column->toArray();
            }
        }
        if (!empty($this->_primaryKey)) {
            foreach ($this->_primaryKey as $name => $column) {
                $data['primary_key'][] = $column->getName();
            }
        }
        foreach ($this->getIndexes() as $name => $index) {
            if ($assoc) {
                $data['indexes'][$name] = $index->toArray();
            } else {
                $data['indexes'][] = $index->toArray();
            }
        }
        return $data;
    }
public function toArray($assoc=false)
    {
        $data = array(
            'name' => $this->_name,
            'comment' => $this->getComment(),
        );
        foreach ($this->_columns as $name => $column) {
            if ($assoc) {
                $data['columns'][$name] = $column->toArray();
            } else {
                $data['columns'][] = $column->toArray();
            }
        }
        if (!empty($this->_primaryKey)) {
            foreach ($this->_primaryKey as $name => $column) {
                $data['primary_key'][] = $column->getName();
            }
        }
        foreach ($this->getIndexes() as $name => $index) {
            if ($assoc) {
                $data['indexes'][$name] = $index->toArray();
            } else {
                $data['indexes'][] = $index->toArray();
            }
        }
        return $data;
    }
public function toArray ( $ assoc = false ) { $ data = array ( 'name' => $ this -> _name , 'comment' => $ this -> getComment ( ) , ) ; foreach ( $ this -> _columns as $ name => $ column ) { if ( $ assoc ) { $ data [ 'columns' ] [ $ name ] = $ column -> toArray ( ) ; } else { $ data [ 'columns' ] [ ] = $ column -> toArray ( ) ; } } if ( ! empty ( $ this -> _primaryKey ) ) { foreach ( $ this -> _primaryKey as $ name => $ column ) { $ data [ 'primary_key' ] [ ] = $ column -> getName ( ) ; } } foreach ( $ this -> getIndexes ( ) as $ name => $ index ) { if ( $ assoc ) { $ data [ 'indexes' ] [ $ name ] = $ index -> toArray ( ) ; } else { $ data [ 'indexes' ] [ ] = $ index -> toArray ( ) ; } } return $ data ; }
Export table data to an associative array

The returned array has the following elements:

- **name**: the table name
- **columns**: array of columns (numeric or associative, depending on
$assoc). See \Nada\Column\AbstractColumn::toArray() for a description
of keys.
- **primary_key**: array of column names for primary key
- **indexes**: array of indexes (numeric or associative, depending on
$assoc). See \Nada\Index::toArray() for a description of keys.
- **mysql**: (MySQL only) array with MySQL-specific data:
- **engine**: table engine

@param bool $assoc
@return array
Export table data to an associative array