Comments (13)
Hi @MartinMystikJonas. Why do you need that functionality? I mean, command can be autowired via constructor and it's lazily created.
from console.
Parent class Command constructor already uses some parameters so I preffer not to mess up with that in my code to avoid incompatibilities. Imho injects are better solution here and I would prefer them over overiding constructor. So I think this could be an useful option.
from console.
Or maybe just give us option to choose CommandLoader class via config. Currently it is not easy to use different loader by just redefining service because of command map parameter.
from console.
Parent class Command constructor already uses some parameters so I preffer not to mess up with that in my code to avoid incompatibilities
That's nonsence. Just call the parent constructor with no arguments and specify command in $defaultName
property.
https://symfony.com/doc/current/console/commands_as_services.html#lazy-loading
from console.
Ok. So I can be sure that redefining constructor signature will be ok. Fine.
Yet maybe support for custom command loader could be useful sometimes.
from console.
I am ok to support other command loader, but I can't imagine any other, can you prepare PR with your idea?
from console.
I will
from console.
I started working on it and I have few questions about what approach select:
- Would you preffer separate config value
lazy: true
commandLoader: \Custom\MyCommandLoader
or allow lazy option to pass class (false = not lazy, true = default loader, class = use specific loader)
lazy: \Custom\MyCommandLoader
- I am thinking of making commandMap as a service so it can be easily autowired to any command loader instead of fixed loader constructor signature. Either service with
getCommandMap() : array
or service directly implementing \ArrayAccess. Do you agree? Which version do you preffer?
from console.
Related Issues (20)
- Bump PHP 7.1
- Entrypoint - Špatná detekce wwwDir HOT 4
- Provide CLI mode, e.q. Contributte\Console\DI\ConsoleExtension(%consoleMode%). HOT 1
- Autoconfigure event dispatcher if available
- Nette 3.0 compatiblity issue
- Lazy mode, BC break? HOT 1
- Basic commands [idea] HOT 7
- The option 'console › version' expects to be string, float given. HOT 1
- PHP 7.3 support HOT 1
- Allow nullable url
- There is not any default HelperSet? HOT 4
- Not able to build without helperSet HOT 3
- Any ETA on stable version supporting PHP 8? HOT 1
- Packages and PHP requirements update HOT 2
- Get rid of foo in sake of newbies HOT 4
- ConsoleExtension doesn't support `Nette\DI\Statement` HOT 1
- Lazy-loading of command dependencies HOT 15
- Compatibility with contributte/di 0.6.* HOT 2
- Support for nette 3.1 and nette/utils 4.0 HOT 4
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 console.