Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup DI container parent class #52

Closed
BilboTav opened this issue Jul 12, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@BilboTav
Copy link

commented Jul 12, 2016

It was possible through specific parameters in Nette 2.3, why it was removed?
Is it possible somehow?

I have this piece of code implemented, which does what I need, but it is ugly hack. I would prefer a clean way.

    public function generateContainer(DI\Compiler $compiler)
    {
        $containerCode = parent::generateContainer($compiler);
        if (isset($this->containerParentClass)) {
            // Hack :-(
            $containerCode = str_replace('extends ' . DI\Container::class, 'extends ' . $this->containerParentClass, $containerCode);
        }

        return $containerCode;
    }
@dg

This comment has been minimized.

Copy link
Member

commented Jul 12, 2016

It should be done by compiler extension. Can you send PR and implement it to the https://github.com/nette/di/blob/master/src/DI/Extensions/DIExtension.php?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.