2017 © Pedro Peláez
 

library presenter-mapping

Improved presenter mapping for PresenterFactory from Nette.

image

nepada/presenter-mapping

Improved presenter mapping for PresenterFactory from Nette.

  • Friday, July 6, 2018
  • by xificurk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,108 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 20 % Grown

The README.md

Presenter Mapping

Build Status Coverage Status Downloads this Month Latest stable, (*1)

Installation

Via Composer:, (*2)

$ composer require nepada/presenter-mapping

Register the extension in config.neon:, (*3)

extensions:
    - Nepada\Bridges\PresenterMappingDI\PresenterMappingExtension

Usage

The extension replaces standard PresenterFactory provided by ApplicationExtension and adds extended support for presenter mapping. The new presenter mapping system is fully compatible with simple mapping from Nette., (*4)

Submodule mapping

Nette supports mapping based only on the root module name, this package adds support for separate mapping for submodules. You can define different mapping for submodule Foo:Bar and it will take precendence over the mapping defined for Foo and * respectively., (*5)

Example:, (*6)

application:
    mapping:
        '*': ['App', 'Module\*', 'Presenter\*']
        'Foo': Foo\*Module\*Presenter
        'Foo:Bar': Bar\*Module\*Presenter

Presenter class mapping

You can define mapping between presenter name and class directly for individual presenters. This is especially useful when you need to override a single presenter from a module provided for example by external composer package., (*7)

Example:, (*8)

application:
    mapping:
        'Foo:Bar:Baz': FooBar\BazPresenter

Configuration from another CompilerExtension

Some extensions may need to setup their own presenter mappings, this can be done in beforeCompile() phase by customizing setup of PresenterMapper., (*9)

$presenterMapper = $containerBuilder->getByType(Nepada\PresenterMapping\PresenterMapper::class);
$containerBuilder->getDefinition($presenterMapper)
    ->addSetup('setPresenterMapping', ['Foo:Bar:Baz', FooBar\BazPresenter::class])
    ->addSetup('setModuleMapping', ['Foo:Bar', 'Bar\*Module\*Presenter'])
    ->addSetup('setModuleMapping', ['Foo', 'Foo\*Module\*Presenter']);

The Versions

24/08 2016

v1.0.0

1.0.0.0

Improved presenter mapping for PresenterFactory from Nette.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Petr Morávek

nette mapping presenter