crud generator throwing exception

i am providing the complete stack trace…anyone help please…!!! This is just annoying ! plzzzzzzzzz help !

CException

Alias "Project.php" is invalid. Make sure it points to an existing directory or file.

/opt/lampp/htdocs/yii/framework/YiiBase.php(343)

331 unset(self::$_includePaths[$pos]);

332 }

333

334 array_unshift(self::$_includePaths,$path);

335

336 if(self::$enableIncludePath && set_include_path(’.’.PATH_SEPARATOR.implode(PATH_SEPARATOR,self::$_includePaths))===false)

337 self::$enableIncludePath=false;

338

339 return self::$_imports[$alias]=$path;

340 }

341 }

342 else

343 throw new CException(Yii::t(‘yii’,‘Alias “{alias}” is invalid. Make sure it points to an existing directory or file.’,

344 array(’{alias}’=>$alias)));

345 }

346

347 /**

348 * Translates an alias into a file path.

349 * Note, this method does not ensure the existence of the resulting file path.

350 * It only checks if the root alias is valid or not.

351 * @param string $alias alias (e.g. system.web.CController)

352 * @return mixed file path corresponding to the alias, false if the alias is invalid.

353 */

354 public static function getPathOfAlias($alias)

355 {

Stack Trace

#0

/opt/lampp/htdocs/yii/framework/gii/generators/crud/CrudCode.php(59): YiiBase::import("Project.php", true)

54

55 public function validateModel($attribute,$params)

56 {

57 if($this->hasErrors(‘model’))

58 return;

59 $class=@Yii::import($this->model,true);

60 if(!is_string($class) || !$this->classExists($class))

61 $this->addError(‘model’, “Class ‘{$this->model}’ does not exist or has syntax error.”);

62 else if(!is_subclass_of($class,‘CActiveRecord’))

63 $this->addError(‘model’, “’{$this->model}’ must extend from CActiveRecord.”);

64 else

#1

/opt/lampp/htdocs/yii/framework/validators/CInlineValidator.php(43): CrudCode->validateModel("model", array())

38 * @param string $attribute the attribute being validated

39 */

40 protected function validateAttribute($object,$attribute)

41 {

42 $method=$this->method;

43 $object->$method($attribute,$this->params);

44 }

45

46 /**

47 * Returns the JavaScript code needed to perform client-side validation by calling the {@link clientValidate} method.

48 * In the client validation code, these variables are predefined:

#2

/opt/lampp/htdocs/yii/framework/validators/CValidator.php(197): CInlineValidator->validateAttribute(CrudCode, "model")

192 else

193 $attributes=$this->attributes;

194 foreach($attributes as $attribute)

195 {

196 if(!$this->skipOnError || !$object->hasErrors($attribute))

197 $this->validateAttribute($object,$attribute);

198 }

199 }

200

201 /**

202 * Returns the JavaScript needed for performing client-side validation.

#3

/opt/lampp/htdocs/yii/framework/base/CModel.php(158): CValidator->validate(CrudCode, null)

153 if($clearErrors)

154 $this->clearErrors();

155 if($this->beforeValidate())

156 {

157 foreach($this->getValidators() as $validator)

158 $validator->validate($this,$attributes);

159 $this->afterValidate();

160 return !$this->hasErrors();

161 }

162 else

163 return false;

#4

/opt/lampp/htdocs/yii/framework/gii/CCodeGenerator.php(158): CModel->validate()

153 $model->loadStickyAttributes();

154 if(isset($_POST[$modelClass]))

155 {

156 $model->attributes=$_POST[$modelClass];

157 $model->status=CCodeModel::STATUS_PREVIEW;

158 if($model->validate())

159 {

160 $model->saveStickyAttributes();

161 $model->prepare();

162 }

163 }

#5

/opt/lampp/htdocs/yii/framework/gii/CCodeGenerator.php(64): CCodeGenerator->prepare()

59 * Child classes mainly need to provide the ‘index’ view for collecting user parameters

60 * for code generation.

61 */

62 public function actionIndex()

63 {

64 $model=$this->prepare();

65 if($model->files!=array() && isset($_POST[‘generate’], $_POST[‘answers’]))

66 {

67 $model->answers=$_POST[‘answers’];

68 $model->status=$model->save() ? CCodeModel::STATUS_SUCCESS : CCodeModel::STATUS_ERROR;

69 }

#6

/opt/lampp/htdocs/yii/framework/web/actions/CInlineAction.php(50): CCodeGenerator->actionIndex()

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 }

#7

/opt/lampp/htdocs/yii/framework/web/CController.php(309): CInlineAction->runWithParams(array("r" => "gii/crud"))

304 {

305 $priorAction=$this->_action;

306 $this->_action=$action;

307 if($this->beforeAction($action))

308 {

309 if($action->runWithParams($this->getActionParams())===false)

310 $this->invalidActionParams($action);

311 else

312 $this->afterAction($action);

313 }

314 $this->_action=$priorAction;

#8

/opt/lampp/htdocs/yii/framework/web/CController.php(287): CController->runAction(CInlineAction)

282 * @see runAction

283 */

284 public function runActionWithFilters($action,$filters)

285 {

286 if(empty($filters))

287 $this->runAction($action);

288 else

289 {

290 $priorAction=$this->_action;

291 $this->_action=$action;

292 CFilterChain::create($this,$action,$filters)->run();

#9

/opt/lampp/htdocs/yii/framework/web/CController.php(266): CController->runActionWithFilters(CInlineAction, array())

261 {

262 if(($parent=$this->getModule())===null)

263 $parent=Yii::app();

264 if($parent->beforeControllerAction($this,$action))

265 {

266 $this->runActionWithFilters($action,$this->filters());

267 $parent->afterControllerAction($this,$action);

268 }

269 }

270 else

271 $this->missingAction($actionID);

#10

/opt/lampp/htdocs/yii/framework/web/CWebApplication.php(276): CController->run("")

271 {

272 list($controller,$actionID)=$ca;

273 $oldController=$this->_controller;

274 $this->_controller=$controller;

275 $controller->init();

276 $controller->run($actionID);

277 $this->_controller=$oldController;

278 }

279 else

280 throw new CHttpException(404,Yii::t(‘yii’,‘Unable to resolve the request “{route}”.’,

281 array(’{route}’=>$route===’’?$this->defaultController:$route)));

#11

/opt/lampp/htdocs/yii/framework/web/CWebApplication.php(135): CWebApplication->runController("gii/crud")

130 foreach(array_splice($this->catchAllRequest,1) as $name=>$value)

131 $_GET[$name]=$value;

132 }

133 else

134 $route=$this->getUrlManager()->parseUrl($this->getRequest());

135 $this->runController($route);

136 }

137

138 /**

139 * Registers the core application components.

140 * This method overrides the parent implementation by registering additional core components.

#12

/opt/lampp/htdocs/yii/framework/base/CApplication.php(162): CWebApplication->processRequest()

157 */

158 public function run()

159 {

160 if($this->hasEventHandler(‘onBeginRequest’))

161 $this->onBeginRequest(new CEvent($this));

162 $this->processRequest();

163 if($this->hasEventHandler(‘onEndRequest’))

164 $this->onEndRequest(new CEvent($this));

165 }

166

167 /**

#13

/opt/lampp/htdocs/ashish/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();

2012-04-06 23:31:51 Apache/2.2.21 (Unix) DAV/2 mod_ssl/2.2.21 OpenSSL/1.0.0c PHP/5.3.8 mod_apreq2-20090110/2.7.1 mod_perl/2.0.5 Perl/v5.10.1 Yii Framework/1.1.10

Hi ashweb, welcome to the forum!

What is ‘Project.php’? Is it a model? And where is it located? I mean, in ‘/protected/models’ or in ‘/protected/modules/some_module/models’?

Hello Sir,

yeahh Project.php is a Model…created it using the gii Model generator and yes it is located in /protected/models !thanks for replying…looking forward to hear from you at the earliest…!! :blink:

The exception message says that yii could not find "Project.php".

So please make sure that you input the right name of that model class in the CRUD generator.

It should be the name of the model class("Project") or the path alias of it("application.models.Project").

And make sure that your model is in fact "Project" and is defined in "Project.php". … There might be some letter casing problem in them.

[EDIT]

"Project" or "application.models.Project", without ".php".

Done !!

Thanks a TON !!