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

Fix attaching routers #2

Merged
merged 1 commit into from
Oct 18, 2013
Merged

Fix attaching routers #2

merged 1 commit into from
Oct 18, 2013

Conversation

PavelJurasek
Copy link
Contributor

I didn't find appropriate way to provide service definitions in
previous implementation. This uses only service name.
Example implementation of IRouterProvider:

class AppExtension extends Nette\DI\CompilerExtension implements \Rixxi\Modular\DI\IRouterProvider
{
    public function loadConfiguration()
    {
        $this->getContainerBuilder()->addDefinition($this->prefix('myRouter'))
            ->setClass('App\MyRouter');
    }

    public function getRouters()
    {   
        return array(
            $this->prefix('@myRouter'),
        );
    }
}

I didn't find appropriate way to provide service definitions in
previous implementation. This implementation uses only service name
mishak87 added a commit that referenced this pull request Oct 18, 2013
@mishak87 mishak87 merged commit 0dcbbac into rixxi:master Oct 18, 2013
@mishak87
Copy link
Contributor

Thank you!

@PavelJurasek PavelJurasek deleted the patch-2 branch October 18, 2013 09:39
@TomasVotruba TomasVotruba mentioned this pull request Jan 8, 2014
@TomasVotruba
Copy link

@PavelJurasek Could you please show me @myRouter example?

@mishak87
Copy link
Contributor

The example is in his example already in loadConfiguration is definition of myRouter service.
Probably setAutowired(FALSE) there should be too.

@TomasVotruba
Copy link

I mean class MyRouter itself.

@PavelJurasek
Copy link
Contributor Author

It can be simply typical RouterFactory from nette/sandbox

class RouterFactory
{

    /**
     * @return \Nette\Application\Routers\RouteList
     */
    public function create()
    {
        $router = new RouteList();

        $router[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');

        return $router;
    }

}

@TomasVotruba
Copy link

Edit: Thanks, works fine. I had some typos in there.

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.

3 participants