Enhanced syntax for NEON hashes
- David Grudl
- Nette Core | 8228
In Neon it is not possible to write this:
- item:
- sub
- sib
You have to do:
-
item:
- sub
- sib
What is benefit? In config you can write:
services:
- App\Helpers\LangResolver:
- setup: ...
- autowired: off
It would be nice if this will be possible too:
services:
- App\Helpers\LangResolver(args, ...)
- setup: ...
- autowired: off
- Filip Procházka
- Moderator | 4668
I would love this syntax
services:
App\Helpers\LangResolver(args, ...):
setup: ...
autowired: off
- Vojtěch Dobeš
- Gold Partner | 1316
What I would personally love to see possible (my often usecase):
services:
- App\Helpers\ILangResolverFactory
create: class(%defaultLang%)
parameters: [defaultLang]
class
is magic placeholder for real name that the factory
creates according to @return
annotation. Using
parameters
for generated factories always ends in duplicating the
@return
annotation.
Last edited by vojtech.dobes (2014-02-13 14:12)
- David Matějka
- Moderator | 6445
@vojtech.dobes: Now you can set only
arguments without class
(create
),
services:
-
implement: App\Helpers\ILangResolverFactory
arguments: [%defaultLang%]
parameters: [defaultLang]
So with this enhancement it will be only
services:
- App\Helpers\ILangResolverFactory
arguments: [%defaultLang%]
parameters: [defaultLang]
- Vojtěch Dobeš
- Gold Partner | 1316
matej21 Yeah, I thought so but I was waiting for confirmation :). Great job!
- David Grudl
- Nette Core | 8228
mkoubik wrote:
Maybe I don't get it but what would be the new syntax for..
This should be valid, but only for indentation using spaces :-(
people:
- name: John
age: 25
- name: Jane
age: 42