How to use a class from a custom app into an other custom app (Deck + Flow)

Hello everyone,

The goal is, based on Flow event, to trigger automatic modifications in the Deck’s structure (create/move cards) using Deck’s controllers.

I am using an other Flow app (flow_notifications) as a base for my own app. I am able to setup my flows and trigger the onEvent() function when needed. Now the question is: how to use a deck controller from there?

My guess was as a first step to include the class I want like this:
use OCA\Deck\Controller\BoardController;

And then I was not sure if I was suppose to make it as a dependency injection like:

class MyApp implements IOperation {
private $boardController;
public function __construct( BoardController $BoardController ){
$this->boardController = $BoardController;
}
}

or use a container in my onEvent() function like this:

public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatcher): void {
$boardController = $container->get(BoardController::class);
}

Both doesn’t seems to work for me. I am probably missing something but I do not see what.

Thanks for your help :slight_smile:

I solved it myself. I made it work as a dependency injection like the first example.