ServicesTrait
trait ServicesTrait (View source)
Properties
protected EntityManagerInterface | $entityManager | ||
protected ContainerInterface | $container | ||
protected Query | $query | ||
protected Config | $boltConfig |
Methods
Injects commonly used objects into the extension, for use by the extension. Called from the listener.
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.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Details
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.
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.