Skip to content

Bug in generating name of presenters, if mapping is changed #909

Closed

Description

@jsifalda

I would like to have got presenters in common namespace e.g. Flame\CMS\FrontModule\Presenters.
Ok, that is not a problem. Now I must change mapping in config:

 application:
        mapping:
            *: Flame\CMS\*Module\Presenters\*Presenter

But I get error: Page not found. Missing template '…/FrontModule/templates/FrontModule\Presenters\Homepage/default.latte'.

Is there bug in generating name of namespace?

Activity

  1. Majkl578 commented on Dec 19, 2012

    @Majkl578
    Contributor

    There is a problem with "Presenters" part. Some tests:

    diff --git a/tests/Nette/Application/PresenterFactory.formatPresenterClass.phpt b/tests/Nette/Application/PresenterFactory.formatPresenterClass.phpt
    index 0ca5bd0..ddee0c2 100644
    --- a/tests/Nette/Application/PresenterFactory.formatPresenterClass.phpt
    +++ b/tests/Nette/Application/PresenterFactory.formatPresenterClass.phpt
    @@ -22,6 +22,7 @@ $factory = new PresenterFactory(NULL, $container);
    
     $factory->mapping['Foo2'] = 'App2\*\*Presenter';
     $factory->mapping['Foo3'] = 'My\App\*Mod\*Presenter';
    +$factory->mapping['Foo4'] = 'My\App\*Mod\Presenters\*Presenter';
    
     Assert::same( 'FooPresenter', $factory->formatPresenterClass('Foo') );
     Assert::same( 'FooModule\BarPresenter', $factory->formatPresenterClass('Foo:Bar') );
    @@ -34,4 +35,7 @@ Assert::same( 'App2\Bar\BazPresenter', $factory->formatPresenterClass('Foo2:Bar:
     Assert::same( 'My\App\BarPresenter', $factory->formatPresenterClass('Foo3:Bar') );
     Assert::same( 'My\App\BarMod\BazPresenter', $factory->formatPresenterClass('Foo3:Bar:Baz') );
    
    +Assert::same( 'My\App\Presenters\BarPresenter', $factory->formatPresenterClass('Foo4:Bar') );
    +Assert::same( 'My\App\BarMod\Presenters\BazPresenter', $factory->formatPresenterClass('Foo4:Bar:Baz') );
    +
     Assert::same( 'NetteModule\FooPresenter', $factory->formatPresenterClass('Nette:Foo') );
    diff --git a/tests/Nette/Application/PresenterFactory.formatPresenterFile.phpt b/tests/Nette/Application/PresenterFactory.formatPresenterFile.phpt
    index 8757a2c..0841810 100644
    --- a/tests/Nette/Application/PresenterFactory.formatPresenterFile.phpt
    +++ b/tests/Nette/Application/PresenterFactory.formatPresenterFile.phpt
    @@ -21,6 +21,7 @@ $container = id(new Nette\Config\Configurator)->setTempDirectory(TEMP_DIR)->crea
     $factory = new PresenterFactory('base', $container);
    
     $factory->mapping['Foo2'] = 'App2\*\*Presenter';
    +$factory->mapping['Foo3'] = 'App2\*\Presenters\*Presenter';
    
     Assert::same( 'base/presenters/FooPresenter.php', $factory->formatPresenterFile('Foo') );
     Assert::same( 'base/FooModule/presenters/BarPresenter.php', $factory->formatPresenterFile('Foo:Bar') );
    @@ -29,3 +30,7 @@ Assert::same( 'base/FooModule/BarModule/presenters/BazPresenter.php', $factory->
     Assert::same( 'base/presenters/Foo2Presenter.php', $factory->formatPresenterFile('Foo2') );
     Assert::same( 'base/Foo2Module/presenters/BarPresenter.php', $factory->formatPresenterFile('Foo2:Bar') );
     Assert::same( 'base/Foo2Module/BarModule/presenters/BazPresenter.php', $factory->formatPresenterFile('Foo2:Bar:Baz') );
    +
    +Assert::same( 'base/presenters/Foo3Presenter.php', $factory->formatPresenterFile('Foo3') );
    +Assert::same( 'base/Foo3Module/presenters/BarPresenter.php', $factory->formatPresenterFile('Foo3:Bar') );
    +Assert::same( 'base/Foo3Module/BarModule/presenters/BazPresenter.php', $factory->formatPresenterFile('Foo3:Bar:Baz') );
    diff --git a/tests/Nette/Application/PresenterFactory.unformatPresenterClass.phpt b/tests/Nette/Application/PresenterFactory.unformatPresenterClass.phpt
    index 03a844d..b020aae 100644
    --- a/tests/Nette/Application/PresenterFactory.unformatPresenterClass.phpt
    +++ b/tests/Nette/Application/PresenterFactory.unformatPresenterClass.phpt
    @@ -22,6 +22,8 @@ $factory = new PresenterFactory(NULL, $container);
    
     $factory->mapping['Foo2'] = 'App2\*\*Presenter';
     $factory->mapping['Foo3'] = 'My\App\*Mod\*Presenter';
    +$factory->mapping['Foo4'] = 'My\App\*Mod\Presenters\*Presenter';
    +//$factory->mapping['Sub1:Sub2'] = 'App\*Mod\*Presenter';
    
     Assert::same( 'Foo', $factory->unformatPresenterClass('FooPresenter') );
     Assert::same( 'Foo:Bar', $factory->unformatPresenterClass('FooModule\BarPresenter') );
    @@ -34,5 +36,8 @@ Assert::same( 'Foo2:Bar:Baz', $factory->unformatPresenterClass('App2\Bar\BazPres
     Assert::same( 'Foo3:Bar', $factory->unformatPresenterClass('My\App\BarPresenter') );
     Assert::same( 'Foo3:Bar:Baz', $factory->unformatPresenterClass('My\App\BarMod\BazPresenter') );
    
    +Assert::same( 'Foo4:Bar', $factory->unformatPresenterClass('My\App\Presenters\BarPresenter') );
    +Assert::same( 'Foo4:Bar:Baz', $factory->unformatPresenterClass('My\App\BarMod\Presenters\BazPresenter') );
    +
     Assert::same( NULL, $factory->unformatPresenterClass('Foo') );
     Assert::same( NULL, $factory->unformatPresenterClass('FooMod\BarPresenter') );
  2. trunda commented on Jan 22, 2013

    @trunda

    Problem is in this method.

  3. stepansvoboda commented on Jan 23, 2013

    @stepansvoboda
    Contributor

    probably related issue #880

  4. jsifalda commented on Mar 30, 2013

    @jsifalda
    ContributorAuthor

    Is there any solution or explanation? Please.

  5. dg commented on Mar 31, 2013

    @dg
    Member

    There is nearly the same issue #880.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions