2

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?

Aleš
  • 783
  • 3
  • 7
  • 16

1 Answers1

1

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.

bool.dev
  • 17,508
  • 5
  • 69
  • 93