Get container parameter inside custom renderer class


Hey everyone,

inside my DataObject definition I’m using a layout component of type Text to render a feedback for the user. I’m getting the feedback from another source so I need to use credentials like an API Key that I store inside my .env file in project root.

At another problem I’m getting these credentials inside a controller like intended by Symfony and do all I need to do and it works just fine.

$config = $this->container->getParameter('login');

Now I’m trying to do the same thing inside the mentioned custom renderer class of my DataObject. But I can not get the credentials from my .env file in here as there is no $this->container

Any idea on how to solve this? Is it possible to get the container and/or the credentials in here somehow?
The GUI in the data object definition only allows for passing strings as data passed to the function.

I tried adding a __construct() method but that isn’t called at all.

Any help is appreciated,


Nevermind, I just found a solution by googling for a more general problem.

The Dotenv component in Symfony is what I needed:

I was simply stuck in the mindset of using the container->getParameter() method but as there is no container in the renderer class…
Well, maybe this helps someone else as well.


it should be possible to define a service-id as renderer - so you can build and configure your renderer via the container and inject everything you need…