Yii Framework Forum: Php Warning Include(User.php): Failed To Open Stream: No Such File Or Directory - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Php Warning Include(User.php): Failed To Open Stream: No Such File Or Directory

#1 User is offline   AhmedK 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 18-February 14

Posted 18 February 2014 - 06:07 PM

im in chapter 5 of th book !! and im getting an issue when trying to get the users of the project to display on a list !!im getting this error please help me !!thanks

PHP warning

include(User.php): failed to open stream: No such file or directory

C:\wamp\www\yii\framework\YiiBase.php(427)

415                         {
416                             include($classFile);
417                             if(YII_DEBUG && basename(realpath($classFile))!==$className.'.php')
418                                 throw new CException(Yii::t('yii','Class name "{class}" does not match class file "{file}".', array(
419                                     '{class}'=>$className,
420                                     '{file}'=>$classFile,
421                                 )));
422                             break;
423                         }
424                     }
425                 }
426                 else
427                     include($className.'.php');
428             }
429             else  // class name with namespace in PHP 5.3
430             {
431                 $namespace=str_replace('\\','.',ltrim($className,'\\'));
432                 if(($path=self::getPathOfAlias($namespace))!==false)
433                     include($path.'.php');
434                 else
435                     return false;
436             }
437             return class_exists($className,false) || interface_exists($className,false);
438         }
439         return true;
Stack Trace

#0	
+  C:\wamp\www\yii\framework\YiiBase.php(427): YiiBase::autoload()
#1	
 unknown(0): YiiBase::autoload("User")
#2	
+  C:\wamp\www\yii\framework\db\ar\CActiveRecord.php(395): spl_autoload_call("User")
#3	
+  C:\wamp\www\yii\framework\db\ar\CActiveFinder.php(182): CActiveRecord::model("User")
#4	
+  C:\wamp\www\yii\framework\db\ar\CActiveFinder.php(230): CActiveFinder->getModel("User")
#5	
+  C:\wamp\www\yii\framework\db\ar\CActiveFinder.php(48): CActiveFinder->buildJoinTree(CJoinElement, "users")
#6	
+  C:\wamp\www\yii\framework\db\ar\CActiveRecord.php(909): CActiveFinder->__construct(Project, "users")
#7	
+  C:\wamp\www\yii\framework\db\ar\CActiveRecord.php(280): CActiveRecord->getActiveFinder("users")
#8	
+  C:\wamp\www\yii\framework\db\ar\CActiveRecord.php(143): CActiveRecord->getRelated("users")
#9	
–  C:\wamp\www\trackstar\protected\models\Project.php(138): CActiveRecord->__get("users")
133         return parent::model($className);
134     }
135 
136 public function getUserOptions()
137         {
138             $usersArray = CHtml::listData($this->users, 'id', 'username');
139             return $usersArray;
140             }
141 
142 
143 }
#10	
–  C:\wamp\www\trackstar\protected\views\issue\_form.php(54): Project->getUserOptions()
49         <?php echo $form->error($model,'status_id'); ?>
50     </div>
51 
52     <div class="row">
53         <?php echo $form->labelEx($model,'owner_id'); ?>
54         <?php echo $form->dropDownList($model,'owner_id', $model->project->getUserOptions()); ?>
55         <?php echo $form->error($model,'owner_id'); ?>
56     </div>
57 
58     <div class="row">
59         <?php echo $form->labelEx($model,'requester_id'); ?>
#11	
+  C:\wamp\www\yii\framework\web\CBaseController.php(126): require("C:\wamp\www\trackstar\protected\views\issue\_form.php")
#12	
+  C:\wamp\www\yii\framework\web\CBaseController.php(95): CBaseController->renderInternal("C:\wamp\www\trackstar\protected\views\issue\_form.php", array("model" => Issue), true)
#13	
+  C:\wamp\www\yii\framework\web\CController.php(869): CBaseController->renderFile("C:\wamp\www\trackstar\protected\views\issue\_form.php", array("model" => Issue), true)
#14	
–  C:\wamp\www\trackstar\protected\views\issue\create.php(17): CController->renderPartial("_form", array("model" => Issue))
12     array('label'=>'Manage Issue', 'url'=>array('admin')),
13 );
14 ?>
15 
16 <h1>Create Issue</h1>
17 <?php $this->renderPartial('_form', array('model'=>$model)); ?>
#15	
+  C:\wamp\www\yii\framework\web\CBaseController.php(126): require("C:\wamp\www\trackstar\protected\views\issue\create.php")
#16	
+  C:\wamp\www\yii\framework\web\CBaseController.php(95): CBaseController->renderInternal("C:\wamp\www\trackstar\protected\views\issue\create.php", array("model" => Issue), true)
#17	
+  C:\wamp\www\yii\framework\web\CController.php(869): CBaseController->renderFile("C:\wamp\www\trackstar\protected\views\issue\create.php", array("model" => Issue), true)
#18	
+  C:\wamp\www\yii\framework\web\CController.php(782): CController->renderPartial("create", array("model" => Issue), true)
#19	
–  C:\wamp\www\trackstar\protected\controllers\IssueController.php(133): CController->render("create", array("model" => Issue))
128                 $this->redirect(array('view','id'=>$model->id));
129         }
130 
131         $this->render('create',array('model'=>$model,
132                         )
133             );
134     }
135 
136     /**
137      * Updates a particular model.
138      * If update is successful, the browser will be redirected to the 'view' page.
#20	
+  C:\wamp\www\yii\framework\web\actions\CInlineAction.php(49): IssueController->actionCreate()
#21	
+  C:\wamp\www\yii\framework\web\CController.php(308): CInlineAction->runWithParams(array("r" => "issue/create", "pid" => "1"))
#22	
+  C:\wamp\www\yii\framework\web\filters\CFilterChain.php(133): CController->runAction(CInlineAction)
#23	
–  C:\wamp\www\trackstar\protected\controllers\IssueController.php(42): CFilterChain->run()
37 $this->loadProject($_GET['pid']);
38 else
39 throw new CHttpException(403,'Must specify a project before
40 performing this action.');
41 //complete the running of other filters and execute the requested action
42 $filterChain->run();
43 }
44 
45 
46 
47 
#24	
+  C:\wamp\www\yii\framework\web\filters\CInlineFilter.php(58): IssueController->filterProjectContext(CFilterChain)
#25	
+  C:\wamp\www\yii\framework\web\filters\CFilterChain.php(130): CInlineFilter->filter(CFilterChain)
#26	
+  C:\wamp\www\yii\framework\web\filters\CFilter.php(40): CFilterChain->run()
#27	
+  C:\wamp\www\yii\framework\web\CController.php(1145): CFilter->filter(CFilterChain)
#28	
+  C:\wamp\www\yii\framework\web\filters\CInlineFilter.php(58): CController->filterAccessControl(CFilterChain)
#29	
+  C:\wamp\www\yii\framework\web\filters\CFilterChain.php(130): CInlineFilter->filter(CFilterChain)
#30	
+  C:\wamp\www\yii\framework\web\CController.php(291): CFilterChain->run()
#31	
+  C:\wamp\www\yii\framework\web\CController.php(265): CController->runActionWithFilters(CInlineAction, array("accessControl", "postOnly + delete", "projectContext + create"))
#32	
+  C:\wamp\www\yii\framework\web\CWebApplication.php(282): CController->run("create")
#33	
+  C:\wamp\www\yii\framework\web\CWebApplication.php(141): CWebApplication->runController("issue/create")
#34	
+  C:\wamp\www\yii\framework\base\CApplication.php(180): CWebApplication->processRequest()
#35	
–  C:\wamp\www\trackstar\index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
2014-02-18 23:02:15 Apache/2.4.4 (Win64) PHP/5.4.12 Yii Framework/1.1.14

0

#2 User is offline   Matthew Torres 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 12-February 14

Posted 18 February 2014 - 09:23 PM

It seems you don't have Users Model.
0

#3 User is offline   AhmedK 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 18-February 14

Posted 19 February 2014 - 04:46 AM

after creating User.php im getting this error
CException
Issue and its behaviors do not have a method or closure named "getUserOptions".
0

#4 User is offline   AhmedK 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 18-February 14

Posted 19 February 2014 - 04:52 AM

hahahahahahaha it work :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users