Long Column Names Cause Values Not To Show Up

Dear Yii-Community,

yesterday I had a strange problem. I’ve built a new CActiveModel object which contains columns with names over 35 characters. When I tried to get the data to show up in a “CGridView”, the values for the columns with longer column names were all null or empty.

Here my scenario:

  1. Setting up connection to the database in main.php



'db'=>array(

   'class'=>'CDbConnection',

   'connectionString' => 'dblib:host=myhost;dbname=mydb;charset=utf8',

   'username' => 'myuser',

   'password' => 'mypwd',

   'charset' => 'utf8',

   'tablePrefix' => 't_',

   'schemaCachingDuration' => $schemaCacheDuration,

   'enableProfiling' => true,

   'enableParamLogging' => true,

  )



  1. Building the entity in the database



CREATE TABLE [dbo].[TEST]

(

	[ID] [int] PRIMARY KEY NOT NULL,

	[THIS_IS_A_VERY_LONG_COLUMN_NAME_FOR_TESTING] [nvarchar](400) NULL,

	[SHORTER_COLUMN] [nvarchar](400) NULL

)



  1. Insertion of some data:



insert into TEST values(1, 'this is a test value', 'short value')



  1. Building the model via gii:

  2. Putting the model into an existing and already used view

  3. In the view I did the following:




  $dataProvider=new CActiveDataProvider('TEST', array(

    'criteria'=>array(

        'condition'=>'ID=1',        

    ),

    'pagination'=>false

));

  

  $this->widget('CGridView', array(

    'dataProvider'=>$dataProvider,    

    'columns'  => array(

      'THIS_IS_A_VERY_LONG_COLUMN_NAME_FOR_TESTING',

      'SHORTER_COLUMN'

    )

    'htmlOptions' => array(

        'style' => 'padding: 0px; margin: 0px;',        

    ),   

  ));



When I called the page with the adjusted view, just the data in the column "SHORTER_COLUMN" appeared, but the data from the column "THIS_IS_A_VERY_LONG_COLUMN_NAME_FOR_TESTING" was empty. I already tried it with multiple different long columns and the problem is always the same.

You can find my final output here 5244

check.jpg

Thank you in advance for your help.

Best Regards,

Maurice