yiinitializr icon indicating copy to clipboard operation
yiinitializr copied to clipboard

Gii generator is broken

Open antonkomarev opened this issue 11 years ago • 0 comments

I've tried to use Gii and got an errors. So I've wrote a tiny step-by-step instruction how to fix generated content. Thats not a complete fix, but could be helpfull for a start.

I think Gii should be extended to make it automatically.

For example i've generated Model YiiLog & CRUD for it.


I've recieved an error:

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

In our generated controller class we need to change:

class YiiLogController extends Controller

to:

class YiiLogController extends EController

Then I've recieved an error:

Declaration of YiiLogController::loadModel() should be compatible with EController::loadModel($class, $id, $criteria = Array, $exceptionOnNull = true)

In our generated controller class we need to remove loadModel & performAjaxValidation functions, because they are implemented in EController already.


After that we need to rewrite each call of loadModel function in our controller.

Find every:

$this->loadModel($id)

Change to:

$this->loadModel('YiiLog',$id)

Then I've recieved and error:

Property "YiiLogController.menu" is not defined.

Change ./common/extensions/components/EController.php file. find:

public $breadcrumbs;

add below:

public $menu;

antonkomarev avatar Dec 05 '13 22:12 antonkomarev