-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Improve module manager to accept instance #3814
Improve module manager to accept instance #3814
Conversation
I like the explicitness, but how does your PHP know where these objects are located on disk? The inclusion of this particular application.ini file is before any kind of autoload munging. This would seem to imply that module/ is in your include_path and you have a special autoloader for it? |
@ralphschindler if i use init_autoloader.php like the skeleton (with an autoloader : classmap autoloader, standard autoloader, etc.), there is no problems |
{ | ||
$moduleName = $module; | ||
if(is_object($module)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add space between statement and conditional.
As noted above, I think a few additional tests and use cases need to be considered. |
@weierophinney I updated the PR (test with type & submodule) Do you think in other use cases ? |
$event = ($this->loadFinished === false) ? clone $this->getEvent() : $this->getEvent(); | ||
$event->setModuleName($moduleName); | ||
|
||
if (!is_object($module)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To keep this method clean (and small), perhaps you could move the contents of this if-block to their own method (e.g. loadModuleByName())?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok look cool, I updated my PR
I like the PR from a functional perspective. I'll let it to @weierophinney or @EvanDotPro to do the final review however. Please note, as it primarily introduces new functionality, I think it should be merged into develop only(?). |
Merged to develop for release with 2.2.0. |
- trailing whitespace
Hi,
For the performance and to make learning easier, we can accept modules instances :
Before :
Now, i do :
There is no BC, more natural, and perf little better.