Documentation

Abstract class Phalcon\Di\Injectable

implements Phalcon\Di\InjectionAwareInterface, Phalcon\Events\EventsAwareInterface

Source on GitHub

This class allows to access services in the services container by just only accessing a public property with the same name of a registered service

Methods

public setDI (Phalcon\DiInterface $dependencyInjector)

Sets the dependency injector

public Phalcon\DiInterface getDI ([unknown $error], [unknown $notUseDefault])

Returns the internal dependency injector

public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager)

Sets the event manager

public Phalcon\Events\ManagerInterface getEventsManager ()

Returns the internal event manager

public boolean fireEvent (string $eventName, [mixed $data], [unknown $cancelable])

Fires an event, implicitly calls behaviors and listeners in the events manager are notified

public mixed fireEventCancel (string $eventName, [mixed $data], [unknown $cancelable])

Fires an event, can stop the event by returning to the false

public boolean hasService (string $name)

Check whether the DI contains a service by a name

public Phalcon\Di\ServiceInterface setService (unknown $name)

Sets a service from the DI

public object|null getService (unknown $name)

Obtains a service from the DI

public mixed getResolveService (string $name, [array $args], [unknown $noerror], [unknown $noshared])

Resolves the service based on its configuration

public attachEvent (string $eventType, Closure $callback)

Attach a listener to the events

public __get (unknown $property)

Magic method __get

public __sleep ()

...

public __debugInfo ()

...