Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Group array values declaration #37

Closed
mrtnzlml opened this issue Jan 15, 2017 · 2 comments
Closed

RFC: Group array values declaration #37

mrtnzlml opened this issue Jan 15, 2017 · 2 comments

Comments

@mrtnzlml
Copy link

  • bug report? no
  • feature request? yes

Description

I don't think there is super big chance for this feature, but let's try it... :) As you know in PHP it's possible to use group declarations for namespaces. I found it very useful. And now I am missing this syntax in NEON format. Instead of this:

services:
  - Adeira\Connector\Devices\Application\Service\WeatherStation\AddWeatherStationRecordService
  - Adeira\Connector\Devices\Application\Service\WeatherStation\ViewAllWeatherStationsService
  - Adeira\Connector\Devices\Application\Service\WeatherStation\ViewSingleWeatherStationService

It would be awesome to write just this:

services:
  - Adeira\Connector\Devices\Application\Service\WeatherStation\{
      AddWeatherStationRecordService,
      ViewAllWeatherStationsService,
      ViewSingleWeatherStationService
    }

Also it opens new ways of configuring multiple services at once:

services:
  - class: Adeira\Connector\Devices\Application\Service\WeatherStation\{
      AddWeatherStationRecordService,
      ViewAllWeatherStationsService,
      ViewSingleWeatherStationService
    }
    arguments:
      transactionalSession: @doctrineSession
      ownerService: @userIdOwnerService

But I would be ok with just simple group format without possibilities to configure these services. Unfortunately it means that NEON syntax will be more complicated, but it should be without BC break (works only with [a-z]\\{ ...). What do you think? Or maybe it's just stupid idea... :)

This is maby more related to the Nette\DI package, but it's NEON syntax...

@dg
Copy link
Member

dg commented Jan 15, 2017

To modify the syntax of neon there must be a really serious reason, which this is not. But this works:

services:
  - Adeira\Connector\Devices\Application\Service\WeatherStation\(
      AddWeatherStationRecordService,
      ViewAllWeatherStationsService,
      ViewSingleWeatherStationService
    )

So it can be implemented in nette/di, for example as custom NEON loader.

@mrtnzlml
Copy link
Author

I wasn't very optimistic and I understand. Thanks for the answer @dg - it's way better than thumb down. I will try to solve it differently, because reading those config files is real pain... :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants