We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

What will be inject to the built-in service?

I found at document that some services will be automatically injected when we call:

<?php $di = new Phalcon\DI\FactoryDefault();

(https://docs.phalcon.io/en/latest/reference/di.html#factory-default-di)

But what will be inject to constructors/calls/properties of these services?

I can directly use $this->dispatcher/$this->event in controller, because they have been injected into Controller by Phalcon in a property way.

Is there any document can help me to find out all the injected things?

Hily,

A straightforward way to do it without the doc :


var_dump(new Phalcon\DI\FactoryDefault());

Obviousy you have the full list here : https://docs.phalcon.io/en/latest/reference/di.html#service-name-conventions

Hi Sneaky,

I know that what services will be injected when call new Phalcon\DI\FactoryDefault().

My question is where can I found the services injected defaultly into these services above.

For example: Phalcon\Mvc\Controller will be injected by new Phalcon\DI\FactoryDefault(), and then I can easy use $this->dispatcher in controller. When is $this->dispatcher injected? And what other services injected into controller as properties?