Hi,
I am new in yii and I have configured test drive application in our yii framework and it’s working properly. I added new field phone in create newuser page, it’s display me on create newuser page but when i submit the page it’s show the below error. Please help me to sort out this basic issue.
Error–>
Property "User.phone" is not defined.
F:\xampp\htdocs\yiiframework\framework\db\ar\CActiveRecord.php(144)
132 */
133 public function __get($name)
134 {
135 if(isset($this->_attributes[$name]))
136 return $this->_attributes[$name];
137 else if(isset($this->getMetaData()->columns[$name]))
138 return null;
139 else if(isset($this->_related[$name]))
140 return $this->_related[$name];
141 else if(isset($this->getMetaData()->relations[$name]))
142 return $this->getRelated($name);
143 else
144 return parent::__get($name);
145 }
146
147 /**
148 * PHP setter magic method.
149 * This method is overridden so that AR attributes can be accessed like properties.
150 * @param string $name property name
151 * @param mixed $value property value
152 */
153 public function __set($name,$value)
154 {
155 if($this->setAttribute($name,$value)===false)
156 {
Stack Trace
#0
- F:\xampp\htdocs\yiiframework\framework\db\ar\CActiveRecord.php(144): CComponent->__get("phone")
#1
- F:\xampp\htdocs\yiiframework\framework\web\helpers\CHtml.php(2044): CActiveRecord->__get("phone")
#2
- F:\xampp\htdocs\yiiframework\framework\web\helpers\CHtml.php(1774): CHtml::resolveValue(User, "phone")
#3
- F:\xampp\htdocs\yiiframework\framework\web\helpers\CHtml.php(1205): CHtml::activeInputField("text", User, "phone", array("size" => 60, "maxlength" => 128, "name" => "User[phone]", "id" => "User_phone"))
#4
- F:\xampp\htdocs\yiiframework\framework\web\widgets\CActiveForm.php(575): CHtml::activeTextField(User, "phone", array("size" => 60, "maxlength" => 128))
#5
– F:\xampp\htdocs\testdrive\protected\views\user\_form.php(32): CActiveForm->textField(User, "phone", array("size" => 60, "maxlength" => 128))
27 <?php echo $form->error($model,‘email’); ?>
28 </div>
29
30 <div class="row">
31 <?php echo $form->labelEx($model,‘phone’); ?>
32 <?php echo $form->textField($model,‘phone’,array(‘size’=>60,‘maxlength’=>128)); ?>
33 <?php echo $form->error($model,‘phone’); ?>
34 </div>
35
36 <div class="row buttons">
37 <?php echo CHtml::submitButton($model->isNewRecord ? ‘Create’ : ‘Save’); ?>