Skip to content

Setup DI container parent class #52

@BilboTav

Description

@BilboTav

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;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions