문제

I am trying to create CRUD for my model classed generated automatically by GII.

Classes are stored like models/entity/Article.php. When i try to Gii generator put as class name models.entity.SomeClass or entity.SomeClass it doesn`t work.

The gii stops with exception Alias "entity.Article" is invalid. Make sure it points to an existing directory or file.

How can I run CRUD script properly?

도움이 되었습니까?

해결책

Set the alias in your config/main.php file (do this before the return array):

Yii::setPathOfAlias('entity',dirname(__FILE__).DIRECTORY_SEPARATOR.'../models/entity');

// rest of config
return array(
    // ...
);

Then use entity.Article in gii.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top