How to register callback in service tag?

Notice: This thread is very old.
JuniorJR
Member | 181
+
0
-

I'm using nette master, is there a way for registering callbacks (particularly in service tag(s) and using generated factory)?

$containerBuilder->addDefinition($this->prefix('myFactory'))
    ->setImplement('App\IMyFactory')
    ->addTag('myTag', [
        'callback' => '@' . $this->prefix('myFactory') . '::create', // does not work as generated factory does not inherit from Nette\Object :(
    ]);

Thanks for advice.

Felix
Nette Core | 1245
+
0
-

I'm not sure. But I think it's not possible.

What do you need it for?

JuniorJR
Member | 181
+
0
-

I had a component container which should contain list of factory callbacks for nested components. I've solved it by registering interface not general callback. I've been thinking callback would suffice but due to this problem it doesn't.