Comments (6)
You should never add any services after loadConfiguration, even if you have to partially configure them later!
http://doc.nette.org/en/2.2/di-extensions#toc-beforecompile
from di.
@lookyman well, I understand that this is the only way how to get this working now, but it's massive BC break, nowhere mentioned; also the API & the method name is bad, it makes me really unhappy to create service definitions in method named loadConfiguration.
There are two possibilities:
- Make it (somehow) backward compatible.
- Let this be, and disallow adding new services in beforeCompile time, to fail asap.
But, to be honest, the motivation to call prepareClassList() (added after my feature request), is exactly the possibility to add services dynamicly in beforeCompile time. Otherwise, I don't see much added value.
from di.
it's massive BC break, nowhere mentioned
http://doc.nette.org/en/2.2/di-extensions#toc-beforecompile
In beforeCompile phase we should not add any more services, however you can modify already existing ones or add relations between services (for example using tags).
You're doin' it wrong ;-)
from di.
it makes me really unhappy to create service definitions in method named loadConfiguration.
Service definitions are configuration of DIC. So it was meant as "load your configuration into container builder", not "load configuration from some file or whatever".
from di.
@hrach There is actually much more added value by the early preparedClassList. Mainly Kdyby/Events don't work well without it and now we can use $builder->getByType()
in beforeCompile which allows you to not relly on service names of other extensions. There were some other cases where it helped me which I no longer remember.
from di.
@dg Thanks! What about deprecating adding new service in beforeCompile()?
from di.
Related Issues (20)
- Service constructor: add native support for strict array type. HOT 4
- Service inject initiator
- Tracy panel for DI is too slow HOT 1
- Autoload-based automatic registration of service dependencies HOT 5
- DI not accepting null value of Nette config parameter if parameter is Object HOT 5
- Arguments are not unpacked when creating instance in DI extension HOT 1
- Decorators not called HOT 6
- Concatenate static parameter with string ends with exception HOT 2
- Malfunctioning use of variadic arguments in combination with autowired HOT 1
- Multifactory does not work
- Dynamic parameter does not work in static parameter HOT 27
- SearchExtension: compatible with trait Nette\StaticClass HOT 1
- Parent method with static type, has a badly evaluated return type for factory method in container
- Compiler error in process schema after update to 3.1.4 HOT 2
- Circular reference detected for variables HOT 5
- wrong inject of variables after update 3.1.6 > 3.1.7 HOT 3
- "ERROR: Circular reference detected for:" instead of creating Service with array of strings as parameters HOT 5
- Nette\DI\Config\Loader::load($filePath) loads string parameter '@12345' as string '@@12345' HOT 3
- Parameters defined using function notation in neon config not available when calling getParameter HOT 4
- Support `new` in initializers 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 di.