[rtl]با سلام.
با همان مثال عمومی blog داشتم با فریمورک Yii آشنا می شدم که با خطای زیر روبرو شدم. هر چی ruleها را چک می کنم متوجه دلیل خطا نمی شوم.
کسی می تونه کمک کنه؟[/rtl]
CException
Post has an invalid validation rule. The rule must specify attributes to be validated and the validator name.
/var/www/yii/framework/base/CModel.php(287)
275 * Creates validator objects based on the specification in {@link rules}.
276 * This method is mainly used internally.
277 * @return CList validators built based on {@link rules()}.
278 */
279 public function createValidators()
280 {
281 $validators=new CList;
282 foreach($this->rules() as $rule)
283 {
284 if(isset($rule[0],$rule[1])) // attributes, validator name
285 $validators->add(CValidator::createValidator($rule[1],$this,$rule[0],array_slice($rule,2)));
286 else
287 throw new CException(Yii::t('yii','{class} has an invalid validation rule. The rule must specify attributes to be validated and the validator name.',
288 array('{class}'=>get_class($this))));
289 }
290 var_dump($validators);
291 return $validators;
292 }
293
294 /**
295 * Returns a value indicating whether the attribute is required.
296 * This is determined by checking if the attribute is associated with a
297 * {@link CRequiredValidator} validation rule in the current {@link scenario}.
298 * @param string $attribute attribute name
299 * @return boolean whether the attribute is required
Stack Trace
#0
+
/var/www/yii/framework/base/CModel.php(259): CModel->createValidators()
#1
+
/var/www/yii/framework/web/helpers/CHtml.php(1871): CModel->getValidators("id")
#2
+
/var/www/yii/framework/web/helpers/CHtml.php(1217): CHtml::activeInputField("text", Post, "id", array("name" => "Post[id]", "id" => "Post_id"))
#3
+
/var/www/yii/framework/web/widgets/CActiveForm.php(658): CHtml::activeTextField(Post, "id", array())
#4
–
/var/www/nasr/protected/views/post/_search.php(16): CActiveForm->textField(Post, "id")
11 'method'=>'get',
12 )); ?>
13
14 <div class="row">
15 <?php echo $form->label($model,'id'); ?>
16 <?php echo $form->textField($model,'id'); ?>
17 </div>
18
19 <div class="row">
20 <?php echo $form->label($model,'title'); ?>
21 <?php echo $form->textField($model,'title',array('size'=>50,'maxlength'=>50)); ?>
#5
+
/var/www/yii/framework/web/CBaseController.php(127): require("/var/www/nasr/protected/views/post/_search.php")
#6
+
/var/www/yii/framework/web/CBaseController.php(96): CBaseController->renderInternal("/var/www/nasr/protected/views/post/_search.php", array("model" => Post), true)
#7
+
/var/www/yii/framework/web/CController.php(870): CBaseController->renderFile("/var/www/nasr/protected/views/post/_search.php", array("model" => Post), true)
#8
–
/var/www/nasr/protected/views/post/admin.php(40): CController->renderPartial("_search", array("model" => Post))
35
36 <?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
37 <div class="search-form" style="display:none">
38 <?php $this->renderPartial('_search',array(
39 'model'=>$model,
40 )); ?>
41 </div><!-- search-form -->
42
43 <?php $this->widget('zii.widgets.grid.CGridView', array(
44 // 'id'=>'post-grid',
45 'dataProvider'=>$model->search(),
#9
+
/var/www/yii/framework/web/CBaseController.php(127): require("/var/www/nasr/protected/views/post/admin.php")
#10
+
/var/www/yii/framework/web/CBaseController.php(96): CBaseController->renderInternal("/var/www/nasr/protected/views/post/admin.php", array("model" => Post), true)
#11
+
/var/www/yii/framework/web/CController.php(870): CBaseController->renderFile("/var/www/nasr/protected/views/post/admin.php", array("model" => Post), true)
#12
+
/var/www/yii/framework/web/CController.php(783): CController->renderPartial("admin", array("model" => Post), true)
#13
–
/var/www/nasr/protected/controllers/PostController.php(149): CController->render("admin", array("model" => Post))
144 // ));
145 $model = new Post('search');
146 if (isset($_GET['Post'])) {
147 $model -> attributes = $_GET['Post'];
148 }
149 $this -> render('admin', array('model' => $model));
150 }
151
152 /**
153 * Returns the data model based on the primary key given in the GET variable.
154 * If the data model is not found, an HTTP exception will be raised.