akDeveloper / yaf_base_application

An example of a base application for Yaf framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yaf_Loader could not find controller.

akDeveloper opened this issue · comments

PostController throws exception when try to navigate to uri /admin/posts/index

Could not find class PostsController in controller script ../modules/Admin/controllers/Posts.php

PostsControlleris in Admin module and extends AdminController from Admin module too. AdminController extends ApplicationController from default module.

Maybe too many extends causes this issue?

if PostController extends ApplicationController then everything works fine.

/project/app/modules/Admin/controllers/Admin.php

class AdminController extends ApplicationController {
public function init() {
parent::init();
}
}

/project/app/modules/Admin/controllers/Login.php

Yes this is how i solve it too. But i think the right way is to be fixed by Yaf loader.

Also add this after parent::init() so controllers that extend AdminController can load views from Admin module.

// Set View path for module.
$path = $this->getConfig()->application->directory . "/modules/Admin/views";
$this->getView()->setScriptPath($path);