How to get all services from DI container?

Notice: This thread is very old.
Honza Kuchař
Member | 1662
+
+1
-

Is it possible to get all registered services from DI container?

I'm working on RPC API and I need to scan all service classes for annotation. And if they pass they are added to list for remoting-enabled classes. Is bad habit to go through all services? What is the best-practise?

jiri.pudil
Nette Blogger | 1028
+
+1
-

Z hotového kontejneru to IMO nejde. Jde to na úrovni ContainerBuilderu, tzn. v compiler extension, tam bych na to ale šel spíš přes tagy (viz třeba Kdyby/Events).

mkoubik
Member | 728
+
+1
-

Vytvoř si compiler extension, v té si je vytáhni pomocí $this->getContainerBuilder()->getDefinitions() a vytvoř si nějakou službu do které si je všechny nastrkáš.

Patrik Votoček
Member | 2221
+
+2
-

<OT>bylo by dobre do anglickeho fora psat anglicky</OT>

Honza Kuchař
Member | 1662
+
0
-

Pardon, omlouvám se, musel jsem se uklepnout… Bohužel tu není, možné přesouvat otázky mezi jazyky. :-/ Přeložil jsem otázku do angličtiny.