trait ServicesTrait (View source)

Properties

protected EntityManagerInterface $entityManager
protected ContainerInterface $container
protected Query $query
protected Config $boltConfig

Methods

void
injectObjects(array $objects)

Injects commonly used objects into the extension, for use by the extension. Called from the listener.

getService(string $name)

This bit of code allows us to get services from the container, even if they are not marked public. We need to be able to do this, because we can't anticipate which services an extension's author will want to get, and neither should we want to make them all public. So, we resort to this, regardless of them being private / public. With great power comes great responsibility.

Collection
getAllServiceNames()

No description

Widgets|null
getWidgets()

No description

getBoltConfig()

No description

Environment
getTwig()

No description

Session
getSession()

No description

EventDispatcherInterface
getEventDispatcher()

No description

EntityManagerInterface
getObjectManager()

No description

Stopwatch
getStopwatch()

No description

LoggerInterface
getLogger()

No description

ContainerInterface
getContainer()

No description

getQuery()

No description

Request
getRequest()

No description

Details

void injectObjects(array $objects)

Injects commonly used objects into the extension, for use by the extension. Called from the listener.

Parameters

array $objects

Return Value

void

See also

ExtensionSubscriber

getService(string $name)

This bit of code allows us to get services from the container, even if they are not marked public. We need to be able to do this, because we can't anticipate which services an extension's author will want to get, and neither should we want to make them all public. So, we resort to this, regardless of them being private / public. With great power comes great responsibility.

Note: We wouldn't have to do this, if we could Autowire services in our own code. If you have good ideas on how to accomplish that, we'd be happy to hear from your ideas.

Parameters

string $name

Exceptions

ReflectionException

Collection getAllServiceNames()

Return Value

Collection

Widgets|null getWidgets()

Return Value

Widgets|null

Config getBoltConfig()

Return Value

Config

Environment getTwig()

Return Value

Environment

Session getSession()

Return Value

Session

EventDispatcherInterface getEventDispatcher()

Return Value

EventDispatcherInterface

EntityManagerInterface getObjectManager()

Return Value

EntityManagerInterface

Stopwatch getStopwatch()

Return Value

Stopwatch

LoggerInterface getLogger()

Return Value

LoggerInterface

ContainerInterface getContainer()

Return Value

ContainerInterface

Query getQuery()

Return Value

Query

Request getRequest()

Return Value

Request