pungpoo / giix

Automatically exported from code.google.com/p/giix
0 stars 0 forks source link

$uncheck not initialised #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a new database of sqlite (attached).
2. Generate models/cruds using Giix.
3. Create a new 'offkai' using create button.

What do you see instead?
PHP error of '$uncheck' is not defined.

Please paste the stack trace and the error message.

Please check if the version in the trunk is working. Is it?
No.

Please attach your relevant source files and sql scripts.

Please provide any additional information below.

$uncheck valiable may not be initialised in the method 

Original issue reported on code.google.com by mocapapa...@gtempaccount.com on 27 May 2011 at 5:48

Attachments:

GoogleCodeExporter commented 8 years ago
I was able to reproduce the error as follows.
-- 
PHP Error

Undefined variable: uncheck

/var/www/html/yii/demos/aaa/protected/extensions/giix-components/GxHtml.php(43)

31      * @param array $htmlOptions addtional HTML options.
32      * @return string the generated check box list
33      */
34     public static function activeCheckBoxList($model, $attribute, $data, 
$htmlOptions = array()) {
35         self::resolveNameID($model, $attribute, $htmlOptions);
36         $selection = self::selectData(self::resolveValue($model, 
$attribute)); // #Change: Added support to HAS_MANY and MANY_MANY relations.
37         if ($model->hasErrors($attribute))
38             self::addErrorCss($htmlOptions);
39         $name = $htmlOptions['name'];
40         unset($htmlOptions['name']);
41 
42         $hiddenOptions = isset($htmlOptions['id']) ? array('id' => 
self::ID_PREFIX . $htmlOptions['id']) : array('id' => false);
43         $hidden = $uncheck !== null ? self::hiddenField($name, $uncheck, 
$hiddenOptions) : '';
44 
45         return $hidden . self::checkBoxList($name, $selection, $data, 
$htmlOptions);
46     }
47 
48     /**
49      * Generates the data suitable for list-based HTML elements.
50      * #MethodTracker (complex changes)
51      * This method is based on {@link CHtml::listData}, from version 1.1.7 
(r3135). Changes:
52      * <ul>
53      * <li>This method supports {@link GxActiveRecord::representingColumn()} 
and {@link GxActiveRecord::toString()}.</li>
54      * <li>This method supports tables with composite primary keys.</li>
55      * </ul>

Stack Trace
#0  
+
–
 /var/www/html/yii/demos/aaa/protected/extensions/giix-components/GxActiveForm.php(36): GxHtml::activeCheckBoxList(Offkai, "sankasyas", array(), array())

31      * @param array $data Value-label pairs used to generate the check box 
list.
32      * @param array $htmlOptions Addtional HTML options.
33      * @return string The generated check box list.
34      */
35     public function checkBoxList($model, $attribute, $data, $htmlOptions = 
array()) {
36         return GxHtml::activeCheckBoxList($model, $attribute, $data, 
$htmlOptions);
37     }
38 
39 }

#1  
+
–
 /var/www/html/yii/demos/aaa/protected/views/offkai/_form.php(73): GxActiveForm->checkBoxList(Offkai, "sankasyas", array())

68         <?php echo $form->textField($model, 'modified'); ?>
69         <?php echo $form->error($model,'modified'); ?>
70         </div><!-- row -->
71 
72         <label>Sankasyas</label>
73         <?php echo $form->checkBoxList($model, 'sankasyas', 
GxHtml::encodeEx(GxHtml::listDataEx(Sankasya::model()->findAllAttributes(null, 
true)), false, true)); ?>
74 
75 <?php
76 echo GxHtml::submitButton(Yii::t('app', 'Save'));
77 $this->endWidget();
78 ?>

#2  
+
–
 /var/www/html/yii/framework/web/CBaseController.php(119): require("/var/www/html/yii/demos/aaa/protected/views/offkai/_form.php")

114             $data=$_data_;
115         if($_return_)
116         {
117             ob_start();
118             ob_implicit_flush(false);
119             require($_viewFile_);
120             return ob_get_clean();
121         }
122         else
123             require($_viewFile_);
124     }

#3  
+
–
 /var/www/html/yii/framework/web/CBaseController.php(88): CBaseController->renderInternal("/var/www/html/yii/demos/aaa/protected/views/offkai/_form.php", array("model" => Offkai, "buttons" => "create"), true)

83     {
84         $widgetCount=count($this->_widgetStack);
85         if(($renderer=Yii::app()->getViewRenderer())!==null && 
$renderer->fileExtension==='.'.CFileHelper::getExtension($viewFile))
86             $content=$renderer->renderFile($this,$viewFile,$data,$return);
87         else
88             $content=$this->renderInternal($viewFile,$data,$return);
89         if(count($this->_widgetStack)===$widgetCount)
90             return $content;
91         else
92         {
93             $widget=end($this->_widgetStack);

#4  
+
–
 /var/www/html/yii/framework/web/CController.php(866): CBaseController->renderFile("/var/www/html/yii/demos/aaa/protected/views/offkai/_form.php", array("model" => Offkai, "buttons" => "create"), true)

861      */
862     public function 
renderPartial($view,$data=null,$return=false,$processOutput=false)
863     {
864         if(($viewFile=$this->getViewFile($view))!==false)
865         {
866             $output=$this->renderFile($viewFile,$data,true);
867             if($processOutput)
868                 $output=$this->processOutput($output);
869             if($return)
870                 return $output;
871             else

#5  
+
–
 /var/www/html/yii/demos/aaa/protected/views/offkai/create.php(18): CController->renderPartial("_form", array("model" => Offkai, "buttons" => "create"))

13 <h1><?php echo Yii::t('app', 'Create'); ?> Offkai</h1>
14 
15 <?php
16 $this->renderPartial('_form', array(
17         'model' => $model,
18         'buttons' => 'create'));
19 ?>

#6  
+
–
 /var/www/html/yii/framework/web/CBaseController.php(119): require("/var/www/html/yii/demos/aaa/protected/views/offkai/create.php")

114             $data=$_data_;
115         if($_return_)
116         {
117             ob_start();
118             ob_implicit_flush(false);
119             require($_viewFile_);
120             return ob_get_clean();
121         }
122         else
123             require($_viewFile_);
124     }

#7  
+
–
 /var/www/html/yii/framework/web/CBaseController.php(88): CBaseController->renderInternal("/var/www/html/yii/demos/aaa/protected/views/offkai/create.php", array("model" => Offkai), true)

83     {
84         $widgetCount=count($this->_widgetStack);
85         if(($renderer=Yii::app()->getViewRenderer())!==null && 
$renderer->fileExtension==='.'.CFileHelper::getExtension($viewFile))
86             $content=$renderer->renderFile($this,$viewFile,$data,$return);
87         else
88             $content=$this->renderInternal($viewFile,$data,$return);
89         if(count($this->_widgetStack)===$widgetCount)
90             return $content;
91         else
92         {
93             $widget=end($this->_widgetStack);

#8  
+
–
 /var/www/html/yii/framework/web/CController.php(866): CBaseController->renderFile("/var/www/html/yii/demos/aaa/protected/views/offkai/create.php", array("model" => Offkai), true)

861      */
862     public function 
renderPartial($view,$data=null,$return=false,$processOutput=false)
863     {
864         if(($viewFile=$this->getViewFile($view))!==false)
865         {
866             $output=$this->renderFile($viewFile,$data,true);
867             if($processOutput)
868                 $output=$this->processOutput($output);
869             if($return)
870                 return $output;
871             else

#9  
+
–
 /var/www/html/yii/framework/web/CController.php(779): CController->renderPartial("create", array("model" => Offkai), true)

774      */
775     public function render($view,$data=null,$return=false)
776     {
777         if($this->beforeRender($view))
778         {
779             $output=$this->renderPartial($view,$data,true);
780             if(($layoutFile=$this->getLayoutFile($this->layout))!==false)
781                 
$output=$this->renderFile($layoutFile,array('content'=>$output),true);
782 
783             $this->afterRender($view,$output);
784 

#10     
+
–
 /var/www/html/yii/demos/aaa/protected/controllers/OffkaiController.php(27): CController->render("create", array("model" => Offkai))

22                 else
23                     $this->redirect(array('view', 'id' => 
$model->offkaicode));
24             }
25         }
26 
27         $this->render('create', array( 'model' => $model));
28     }
29 
30     public function actionUpdate($id) {
31         $model = $this->loadModel($id, 'Offkai');
32 

#11     
+
–
 /var/www/html/yii/framework/web/actions/CInlineAction.php(50): OffkaiController->actionCreate()

45         $controller=$this->getController();
46         $method=new ReflectionMethod($controller, $methodName);
47         if($method->getNumberOfParameters()>0)
48             return $this->runWithParamsInternal($controller, $method, 
$params);
49         else
50             return $controller->$methodName();
51     }
52 
53 }

#12     
+
–
 /var/www/html/yii/framework/web/CController.php(300): CInlineAction->runWithParams(array("r" => "offkai/create"))

295     {
296         $priorAction=$this->_action;
297         $this->_action=$action;
298         if($this->beforeAction($action))
299         {
300             if($action->runWithParams($this->getActionParams())===false)
301                 $this->invalidActionParams($action);
302             else
303                 $this->afterAction($action);
304         }
305         $this->_action=$priorAction;

#13     
+
–
 /var/www/html/yii/framework/web/CController.php(278): CController->runAction(CInlineAction)

273      * @see runAction
274      */
275     public function runActionWithFilters($action,$filters)
276     {
277         if(empty($filters))
278             $this->runAction($action);
279         else
280         {
281             $priorAction=$this->_action;
282             $this->_action=$action;
283             CFilterChain::create($this,$action,$filters)->run();

#14     
+
–
 /var/www/html/yii/framework/web/CController.php(257): CController->runActionWithFilters(CInlineAction, array())

252         {
253             if(($parent=$this->getModule())===null)
254                 $parent=Yii::app();
255             if($parent->beforeControllerAction($this,$action))
256             {
257                 $this->runActionWithFilters($action,$this->filters());
258                 $parent->afterControllerAction($this,$action);
259             }
260         }
261         else
262             $this->missingAction($actionID);

#15     
+
–
 /var/www/html/yii/framework/web/CWebApplication.php(346): CController->run("create")

341         {
342             list($controller,$actionID)=$ca;
343             $oldController=$this->_controller;
344             $this->_controller=$controller;
345             $controller->init();
346             $controller->run($actionID);
347             $this->_controller=$oldController;
348         }
349         else
350             throw new CHttpException(404,Yii::t('yii','Unable to resolve 
the request "{route}".',
351                 
array('{route}'=>$route===''?$this->defaultController:$route)));

#16     
+
–
 /var/www/html/yii/framework/web/CWebApplication.php(139): CWebApplication->runController("offkai/create")

134             foreach(array_splice($this->catchAllRequest,1) as $name=>$value)
135                 $_GET[$name]=$value;
136         }
137         else
138             $route=$this->getUrlManager()->parseUrl($this->getRequest());
139         $this->runController($route);
140     }
141 
142     /**
143      * Registers the core application components.
144      * This method overrides the parent implementation by registering 
additional core components.

#17     
+
–
 /var/www/html/yii/framework/base/CApplication.php(155): CWebApplication->processRequest()

150      */
151     public function run()
152     {
153         if($this->hasEventHandler('onBeginRequest'))
154             $this->onBeginRequest(new CEvent($this));
155         $this->processRequest();
156         if($this->hasEventHandler('onEndRequest'))
157             $this->onEndRequest(new CEvent($this));
158     }
159 
160     /**

#18     
+
–
 /var/www/html/yii/demos/aaa/index.php(13): CApplication->run() 

Original comment by mocapapa...@gtempaccount.com on 27 May 2011 at 5:51

GoogleCodeExporter commented 8 years ago
This is a known issue. Merging into issue 10.
Thank you for checking the trunk code out!

Original comment by rodrigo.coelho@gmail.com on 27 May 2011 at 9:17