Skip to content

Allow array as presenter mapping #101

@enumag

Description

@enumag

The PresenterFactory splits the mapping mask to 3 parts - a prefix, a part which is reapeated for each module and a part for presenter. The problem is that there is no way to actually configure the 3 parts separately. In my case I need the mapping to look like this:

'*' => array('App\', 'Module\*Module\', 'Presenter\*Presenter')

This is currently not possible to achieve. I tried the following:

nette.application:
    mapping:
        *: App\Module\*Module\Presenter\*Presenter
# result:
# '*' => array('App\Module\', '*Module\', 'Presenter\*Presenter')
nette.application:
    mapping:
        *: App\*Module\Module\Presenter\*Presenter
# result:
# '*' => array('App\', '*Module\', 'Module\Presenter\*Presenter')

To achieve the mapping I want I'd have to create my own PresenterFactory. And I can't even extend the default one because the mapping property is private (don't want to hack it using reflection).

Instead I'd like the PresenterFactory to accept an array as well so that this would work:

nette.application:
    mapping:
        *: [ App\, Module\*Module\, Presenter\*Presenter ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions