zored/zf2-to-3

Hacks for migrating from ZF2 to ZF3.

1.0 2018-01-19 21:38 UTC

This package is not auto-updated.

Last update: 2024-10-27 06:39:07 UTC


README

Build Status Coverage Status

Hacks for migrating from ZF2 to ZF3.

Why?

To fast-fix your code before fully moving to ZF3.

How?

  • use \ZF2TO3\ZF2To3AbstractFactoryTrait; in abstract factories.
  • use \ZF2TO3\ZF2To3FactoryTrait; in factories.
  • use \ZF2TO3\ZF2To3ControllerTrait; in controller itself if it depends on service locator.
  • use \ZF2TO3\ZF2To3ServiceLocatorAwareTrait; and custom constructor to get rid of ServiceLocatorAware.
  • Change controller configurations:
    <?php
    return [
        'controllers' => [
            // BEFORE:
            'invokables' => [
                'App\Some' => \App\SomeController::class
            ],
            
            // AFTER:
            'factories' => [
                // Controller should be real class:
                \App\SomeController::class => \ZF2TO3\ZF2To3ControllerFactory::class
            ],
        ],
    ];
  • Read the migration docs and get rid of these hacks!