-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forward action between two modules on this same controllers name #28
Comments
+1 for the namespace, although i dont know if this has any conflict with routes. |
hmm, PHP implemented namespace in a very tricky way, that is, if you define a class Foo in a Namespace Bar, the really class name is 'Bar\Foo", in the opinion of Yaf loader, it equal to class Bar_Foo, so if we supports namespace in module, how can the Yaf Loader tell controller A in module B (B_A) from the ctronller B_A? |
I think in modules controller's name must be like Bar\Foo or Bar_Foo (if namespaces is off). Routes definitions can look this same, because we can get namespace from module name. Only problem is not backward-compatible, but in this form modules don't work correctly. So to answer your question, Yaf loader know it is namespaces on or off (from php.ini), know what module it is from routes or default route like /module/controller/action so Loader can load good controller. But this is only a suggestion there may be a better solution. |
hmm, php.ini is a way(bc), let me think about it. thanks |
There is an issue in the current implementation of modules. Controllers in a module can have the same name with controllers in another module. So Yaf loader can not load the right controller, in some cases (forwarding, extending). Assuming the controllers But maybe there is also an Right now, Yaf defines the current module from the Request right? That is why can handle controllers with the same name in different modules. But when there is a need to extend a controller between modules or forward a controller from a module to another, then appears the above problem. |
Hey Just encountered this issue. Thanks, Ofer |
同感 |
When we have this same controller in two modules, example:
And in /modules/Admin/controllers/Index.php we do:
Then run indexAction in IndexController in Admin module but we want Index module.
My suggestion is to use namespace for controllers and models, with the name of the module. No namespace is the default module. Example
The text was updated successfully, but these errors were encountered: