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

Improved Compiler & Loader extendability #62

Merged
merged 1 commit into from
Jan 30, 2017
Merged

Improved Compiler & Loader extendability #62

merged 1 commit into from
Jan 30, 2017

Conversation

lookyman
Copy link
Contributor

No description provided.

@JanTvrdik
Copy link
Contributor

Can you describe the use case?

@lookyman
Copy link
Contributor Author

<?php

use Tester\Assert;

require __DIR__ . '/../bootstrap.php';

class TestCompiler extends Nette\DI\Compiler
{
    public function createLoader()
    {
        return (new Nette\DI\Config\Loader)->addAdapter('yml', new YmlAdapter);
    }
}

$compiler = new TestCompiler;
$compiler->loadConfig(__DIR__ . '/config.yml');
$container = $compiler->compile();

// Tester::assert(...)

And yes, I do realize that currently I only have to override a method that is just three lines longer. Or load the config with my own loader and pass it to Compiler::compile(). Or do it any other possible way...

@dg
Copy link
Member

dg commented Mar 4, 2015

createLoader & createCompiler should be protected.

@lookyman
Copy link
Contributor Author

lookyman commented Mar 4, 2015

@dg right..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants