Comments (3)
I see what you mean, but just to be clear this is the small BC-break introduced in 3.2 right? (https://github.com/mnapoli/PHP-DI/releases/tag/3.2.0)
It's a shame the constructor calls init, and not the dispatcher.
+1
Another option is to override the init and include an InjectOn call against itself so that the dependencies are there. This would get you away from a custom dispatcher being required. The drawback is you have to get a handle to the DI container in your init call. If you instantiate the DIcontainer in a bootstrap file it's ugly to pass it down, so it may be better to instantiate it in the init itself.
Seems like the best option to me, given also that it's probably how it will end up for ZF2 integration.
What could be possible is offering 2 options:
- keep using the provided Dispatcher (best solution), but dependencies are not injected in
init()
- use a base controller class (to be provided by this library) that fetches the dependencies in the constructor if dependencies are needed in
init()
from zf1-bridge.
yes, sorry it was 3.2, guess we were on 3.1 before.
from zf1-bridge.
FYI: i found that moving the logic to preDispatch was the way to go. Especially once i learned that you can use _forward in preDispatch. We had so much ugly code to catch and respond with errors in Init that is now being forwarded to the appropriate error controller instead!
from zf1-bridge.
Related Issues (10)
- Tried wiring this up, autoloader is choking on "Class DI_ZF1_CONTROLLER_PARAMS could not be loaded" HOT 15
- Problem initializing HOT 7
- Sample code not working HOT 5
- The ZF1 bridge requires doctrine annotations? HOT 5
- Should update to allow version 6 HOT 3
- Handling not existent controllers/actions HOT 1
- Let ZF1 load the controller and inject dependencies afterwards HOT 1
- Quickstart should include example of mocking dependency in test HOT 10
- Hard dependency on ZF1 HOT 2
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 zf1-bridge.