public function renderData()
    {
        $columns   = $this->table->getTableColumns();
        $types     = [];
        $structure = [];
        foreach ($columns as $column) {
            $structure[] = snake_case(str_replace('ID', 'Id', $column->getName()));

            $type = $column->getType()->getName();
            switch ($type) {
                case Type::INTEGER:
                case Type::SMALLINT:
                case Type::BIGINT:
                    $types[$column->getName()] = 'int';
                    break;
                case Type::FLOAT:
                    $types[$column->getName()] = 'float';
                    break;
                case Type::DECIMAL:
                    $types[$column->getName()] = 'decimal';
                    break;
                case Type::BOOLEAN:
                    $types[$column->getName()] = 'boolean';
                    break;
                default:
                    $types[$column->getName()] = 'string';
                    break;
            }
        }

        $data = $this->table->getData();

        $tableData = [];
        foreach ($data as $row) {
            $modelData = [];
            foreach ($row as $column => $value) {
                switch ($types[$column]) {
                    case 'int':
                        $value = (int)$value;
                        break;
                    case 'float':
                        $value = (float)$value;
                        break;
                    case 'decimal':
                        $value = (double)$value;
                        break;
                    case 'boolean':
                        // boolean type can be TINYINT(1) but doctrine map TINYINT(1+) as boolean type
                        $value = (int)$value;
                        break;
                    case 'string':
                        $value = (string)$value;
                        break;
                }
                $modelData[] = var_export($value, true);
            }
            $tableData[] = '[' . implode(',', $modelData) . ']';
        }

        return [$structure, '[' . implode(',', $tableData) . ']', count($data)];
    }
public function renderData()
    {
        $columns   = $this->table->getTableColumns();
        $types     = [];
        $structure = [];
        foreach ($columns as $column) {
            $structure[] = snake_case(str_replace('ID', 'Id', $column->getName()));

            $type = $column->getType()->getName();
            switch ($type) {
                case Type::INTEGER:
                case Type::SMALLINT:
                case Type::BIGINT:
                    $types[$column->getName()] = 'int';
                    break;
                case Type::FLOAT:
                    $types[$column->getName()] = 'float';
                    break;
                case Type::DECIMAL:
                    $types[$column->getName()] = 'decimal';
                    break;
                case Type::BOOLEAN:
                    $types[$column->getName()] = 'boolean';
                    break;
                default:
                    $types[$column->getName()] = 'string';
                    break;
            }
        }

        $data = $this->table->getData();

        $tableData = [];
        foreach ($data as $row) {
            $modelData = [];
            foreach ($row as $column => $value) {
                switch ($types[$column]) {
                    case 'int':
                        $value = (int)$value;
                        break;
                    case 'float':
                        $value = (float)$value;
                        break;
                    case 'decimal':
                        $value = (double)$value;
                        break;
                    case 'boolean':
                        // boolean type can be TINYINT(1) but doctrine map TINYINT(1+) as boolean type
                        $value = (int)$value;
                        break;
                    case 'string':
                        $value = (string)$value;
                        break;
                }
                $modelData[] = var_export($value, true);
            }
            $tableData[] = '[' . implode(',', $modelData) . ']';
        }

        return [$structure, '[' . implode(',', $tableData) . ']', count($data)];
    }
public function renderData ( ) { $ columns = $ this -> table -> getTableColumns ( ) ; $ types = [ ] ; $ structure = [ ] ; foreach ( $ columns as $ column ) { $ structure [ ] = snake_case ( str_replace ( 'ID' , 'Id' , $ column -> getName ( ) ) ) ; $ type = $ column -> getType ( ) -> getName ( ) ; switch ( $ type ) { case Type :: INTEGER : case Type :: SMALLINT : case Type :: BIGINT : $ types [ $ column -> getName ( ) ] = 'int' ; break ; case Type :: FLOAT : $ types [ $ column -> getName ( ) ] = 'float' ; break ; case Type :: DECIMAL : $ types [ $ column -> getName ( ) ] = 'decimal' ; break ; case Type :: BOOLEAN : $ types [ $ column -> getName ( ) ] = 'boolean' ; break ; default : $ types [ $ column -> getName ( ) ] = 'string' ; break ; } } $ data = $ this -> table -> getData ( ) ; $ tableData = [ ] ; foreach ( $ data as $ row ) { $ modelData = [ ] ; foreach ( $ row as $ column => $ value ) { switch ( $ types [ $ column ] ) { case 'int' : $ value = ( int ) $ value ; break ; case 'float' : $ value = ( float ) $ value ; break ; case 'decimal' : $ value = ( double ) $ value ; break ; case 'boolean' : // boolean type can be TINYINT(1) but doctrine map TINYINT(1+) as boolean type $ value = ( int ) $ value ; break ; case 'string' : $ value = ( string ) $ value ; break ; } $ modelData [ ] = var_export ( $ value , true ) ; } $ tableData [ ] = '[' . implode ( ',' , $ modelData ) . ']' ; } return [ $ structure , '[' . implode ( ',' , $ tableData ) . ']' , count ( $ data ) ] ; }
Get database table data rendered in model create

@return array[]
Get database table data rendered in model create