What's the smallest syntax for tagged service (NEON)

Notice: This thread is very old.
Tomáš Votruba
Moderator | 1114
+
0
-

Tagging service in config.neon:

-
	class: App\CatalogModule\Filters\LocaleFilter
	tags: [zenify.doctrine.filter]

With this commit, we can drop 1 line:

- class: App\CatalogModule\Filters\LocaleFilter
  tags: [zenify.doctrine.filter]

Is there anything shorter than this?

enumag
Member | 2118
+
-1
-

I don't know anything shorter for one service. However if you have multiple services implementing same interface that should have the same tag, you cen use TemplateExtension from dev Nette.

David Matějka
Moderator | 6445
+
0
-
jiri.pudil
Nette Blogger | 1029
+
+2
-

You can go with this one-liner, but it affects readability (and it's not much shorter actually):

- {class: App\CatalogModule\Filters\LocaleFilter, tags: [zenify.doctrine.filter]}
hrach
Member | 1838
+
0
-

I use this too. It's more readable :)

Tomáš Votruba
Moderator | 1114
+
0
-

@enumag Looks like that didn't get into dev nette (commit), did it?

TemplateExtension source seems like temporary solution for me.

@matej21 I'd prefer native Nette solution. If that doesn't work, I'll check your library. Thanks

Tomáš Votruba
Moderator | 1114
+
0
-

Nice. Seems more readable for me as well.