Comments (7)
It's easy to implement, how about $di = null
by default, to keep backward compatibility?
https://github.com/ice/framework/blob/dev/ice/dispatcher.zep#L189
https://github.com/ice/framework/blob/dev/ice/mvc/moduleinterface.zep#L18
from framework.
@mruz it's fine!
from framework.
let loader = this->di->get("loader")
Will get the loader from te di or create a new if not exist, so maybe that way.
Then ModuleInterface::registerAutoloaders(Loader $loader = null)
, you won't need to update your app if you have just registerAutoloaders()
in every module.
from framework.
an amazing feature that allow user to set a higher loading order for the current module when prepend the loading namespaces: $di->loader->addNamespace(__NAMESPACE__ . '\Controllers', __DIR__ . '/controllers/', true);
from framework.
After a sound thought, pass the loader loading the current module to registerAutoloaders($loader)
to allow developer control the module loading process.
if people want to access the $di
instance, it can be done in registerServices(Di $di)
BTW, add Loader $loader = null
to ModuleInterface::registerAutoloaders(Loader $loader = null)
doesn't keep backward compatibility. So, ModuleInterface::registerAutoloaders(Loader $loader)
is ok
from framework.
@mruz please check my last comment. the follow code will not work as expect, as the loader of the module is not the same as the one in $di->loader
. it safe to pass $loader
but not this->di
.
// better performance
public function registerAutoloaders(Di $di)
{
$di->loader->addNamespace(__NAMESPACE__ . '\Controllers', __DIR__ . '/controllers/');
}
from framework.
I didn't see your comment.
from framework.
Related Issues (20)
- Model, get related record if field is null
- Db, count elements
- Sleet HOT 3
- [1.6.2] broken pecl archive HOT 5
- Router, set routes must be explicitly called
- Sqlite, find one zero results
- Auth file, fetch users from the options
- Db, skip settings if not provided
- View, set engine options on construct HOT 1
- Can Ice support Swoole? HOT 1
- Semver can't be used on pecl HOT 1
- Loader, register namespaces in the constructor
- Di, resolve default services in cli
- PHP 8.1 support
- Install ice via composer instead of pecl HOT 3
- Switch TravisCI to Github Actions
- Install on alpine
- PHP 8.2 support
- Deprecation messages
- Please add the latest version of libraries for Windows HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.