Zend Framework Class Inheritance - Modules with Prefix

Asked

Viewed 167 times

3

I’m developing a PHP project with Zend Framework and I have the following problem:

I created a class called Basecontroller in my "Admin" module. I set the option:

resources.frontController.prefixDefaultModule = "true"

Therefore, the names of my controllers are "Admin_indexcontroller", "Admin_usuariocontroller" and etc.

I need "Admin_indexcontroller" extends "Admin_basecontroller" (a class also created by me) but I only get the message that the class was not found.

Note: I have tried to rename the class to "Admin_basecontroller" or just "Basecontroller" or to implement the code in "Admin_indexcontroller"

class Admin_IndexController extends Admin_BaseController 

or

class Admin_IndexController extends Basecontroller

and no option solved the problem.

Does anyone have any idea what it could be?

  • I don’t know exactly what the problem would be. But because you need the prefix, because you don’t just do it using namespaces. Example. "namespace Admin; class Indexcontroller extends Basecontroller". Basecontroller was declared in Admin namespace as well.

  • Another suggestion, since you are not finding the class, (I do this when it happens to me). I follow the autoload (I use the autoload from Poser) and see where it’s stopping, what it can’t find. Maybe then you can understand the problem.

1 answer

1


Lacked that:

require('Basecontroller.php');

In the controller that will inherit from Basecontroller.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.