SensioLabs

@sensiolabs   sensiolabs.com

ProwebCE
Migration progressive

Sous titre

@sensiolabs   sensiolabs.com

Architecture

SensioLabs

@sensiolabs   sensiolabs.com

Stack

Legacy

Zend1

Home made
framework

Procedural PHP

LegacyWrapper

Symfony 4

API

User

Product

Stock

Stock

TheodoEvolutionLegacyWrapperBundle

Supporte: symfony1.4 / symfony1.5 / CodeIgniter
et custom kernel

Comment ça marche ?

Symfony3 cherche un controller
qui match la request

HTTP Request

Si aucune route Sf3, on passe la main au legacy pour faire le même travail

/**
 * @param GetResponseEvent $event
 *
 * @return GetResponseEvent
 */
public function onKernelRequest(GetResponseEvent $event)
{
    try {
        $this->routerListener->onKernelRequest($event);
    } catch (NotFoundHttpException $e) {
        // Log ...

        $response = $this->legacyKernel->handle($event->getRequest(), 
            $event->getRequestType(), true);

        if ($response->getStatusCode() !== 404) {
            $event->setResponse($response);

            return $event;
        }
    }
}

Router Listener

Custom kernel

class Symfony10Kernel extends LegacyKernel
{
    /** @var ContainerInterface */
    private $container;

    public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
    {
        $context = $this->setUpContext($request);

        ob_start();
        // Dispatch request
        try {
            $context->getController()->dispatch();
        } catch (\sfStopException $e) {
        } catch (\Exception $e) {
            throw $e;
        } finally {
            $context->shutdown();
        }
        $stdout = ob_get_contents();
        ob_end_clean();

        return $this->convertResponse($context->getResponse(), $stdout);
    }

    // ...
}
// \sfContext
# app/config/config.yml

theodo_evolution_legacy_wrapper:
    root_dir: %kernel.root_dir%/../legacy
    kernel:
        id: legacy.kernel.symfony10
        options:
            application: frontend
            environment: '%kernel.environment%'
            debug:       '%kernel.debug%'

Configuration

Authentification cross application

Lecture de session: TheodoEvolutionSessionBundle

 

Authentification:
PreAuthenticatedListener custom

Authentification géré par l'application legacy

Sous titre

@sensiolabs   sensiolabs.com

Aggregation

SensioLabs

@sensiolabs   sensiolabs.com

Types d'aggregation

​Single Purpose Aggregation Operations

Aggregation Pipeline

Map-Reduce

Synchronization

By skigun

Synchronization

  • 290