Pass params to transform function of Transformer class in split Transformer class
Here's how you would do that...


Pass your parameter to the class:


'transformer' =&gt; new MyTransformerClassName($user),



Use a constructor to save it as a property:


class MyTransformerClassName extends TransformerAbstract
{
    private $user;

    public function __construct($user)
    {
        $this-&gt;user = $user;
    }

    public function transform(Entry $entry) ...
}



Use your property as needed:


class MyTransformerClassName extends TransformerAbstract
{
    private $user;

    public function __construct($user) ...


    public function transform(Entry $entry)
    {
        return [
            'user' =&gt; $this-&gt;user,
            ...
        ];
    }
}