How To Make An Attribute Name Case Insensitive

I have an attribute called ‘GroupzDescription’. The column name in DB is groupzdescription. This ambiguity is creating a


CException-Property "Apartment.GroupzDescription" is not defined.

when it executes the following lines -


<?php echo $form->textField($model_apt,'GroupzDescription',array('size' => 60, 'maxlength' => 250)); ?>

try


<?php echo $form->textField($model_apt,'groupzdescription',array('size' => 60, 'maxlength' => 250)); ?>

I don’t know what database are you using but in PostgreSQL if column and table names are not quoted they are not case sensitive. So if you created your schema this way you should only use lowercase when refering to them.

I’m working on MySQL and the database is made case insensitive

I did the same thing as you suggested. Now, I don’t see any exception, but the value of GroupzDescription is not inserted into the table. Default value “NULL” gets inserted. When I checked the logs I see this warning


Failed to set unsafe attribute

can uou please post the model code?

Solved.

I added the following code in model class


public function getGroupzDescription()

{

    return $this->groupzdescription;

}

 

public function setGroupzDescription($groupzdescription)

{

    $this->groupzdescription = $groupzdescription;

}

This is working.