Upgrade to Pro — share decks privately, control downloads, hide ads and more …

InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

InspiringCon15: Bringing TYPO3 Legacy Applications into the Flow

License: CC BY-SA

With the release of TYPO3 Flow in 2011 and TYPO3 Neos in 2012, a both flexible and powerful platform was introduced as a possible successor for TYPO3 CMS. However, migration from TYPO3 CMS to TYPO3 Flow and Neos still presents a challenge due to large conceptual differences between the two systems.

This talk will show how the theoretical concepts (which I presented at an earlier talk at T3CONEU14) can be implemented in software to automate a lot of the necessary steps of a TYPO3-to-Flow migration and also present some real-world applications and experiences.

Martin Helmich

March 28, 2015
Tweet

More Decks by Martin Helmich

Other Decks in Programming

Transcript

  1. CC BY-SA, James Hammond
    https://www.flickr.com/photos/jameshammond/8732132809
    Bringing TYPO3 Legacy
    Applications into the Flow
    Martin Helmich
    [email protected] @martin-helmich
    Inspiring Conference 2015, Kolbermoor
    March 28th, 2015

    View full-size slide

  2. Martin Helmich
    Software Architect at Mittwald
    @martin-helmich
    @mittwald
    CC BY-SA, Wolfgang Wagner
    https://www.flickr.com/photos/wolfgang-wagner/16958684785

    View full-size slide

  3. Legacy
    Applications

    View full-size slide

  4. CC BY-SA, Photones
    http://commons.wikimedia.org/wiki/File:Heureka_(Plastik).jpg

    View full-size slide

  5. CC BY-SA, Gerwin Sturm
    https://www.flickr.com/photos/scarygami/5518831238

    View full-size slide

  6. CC BY, Dude of Lego
    https://www.flickr.com/photos/dudeoflego/5105352800

    View full-size slide

  7. Option #1
    Rewrite
    From Scratch

    View full-size slide

  8. CC BY-SA, D464-Darren Hall
    http://commons.wikimedia.org/wiki/File:Demolition_in_Ballymun_-_Flickr_-_D464-Darren_Hall.jpg

    View full-size slide

  9. Option #2
    Migrate
    Existing Code

    View full-size slide

  10. CC BY-SA, Wolfe House & Building Movers
    http://en.wikipedia.org/wiki/File:Hydrolic_dollies_relocate_house_in_Newark,_Delaware.jpg

    View full-size slide

  11. TYPO3
    FLOW
    TYPO3
    NEOS
    ?
    TYPO3
    CMS

    View full-size slide

  12. TYPO3
    FLOW
    TYPO3
    NEOS
    ?
    TYPO3
    CMS
    TYPO3
    Extbase

    View full-size slide

  13. Extbase
    pibase
    3rd party
    Frameworks
    TYPO3
    FLOW
    TYPO3
    CMS

    View full-size slide

  14. Extbase
    pibase
    3rd party
    Frameworks
    TYPO3
    FLOW
    TYPO3
    CMS

    View full-size slide

  15. Extbase
    pibase
    3rd party
    Frameworks
    TYPO3
    FLOW
    TYPO3
    CMS

    View full-size slide

  16. Extbase
    pibase
    3rd party
    Frameworks
    TYPO3
    FLOW
    TYPO3
    CMS

    View full-size slide

  17. When
    NOT
    to migrate
    from CMS
    to Flow

    View full-size slide

  18. Public Domain (both)
    http://pixabay.com/de/roter-apfel-apple-lecker-di%C3%A4t-83085/ and http://commons.wikimedia.org/wiki/File:Citrus_reticulata.jpg

    View full-size slide

  19. namespace  My\Ext\Domain\Model;  
    use  TYPO3\Flow\Annotations  as  Flow;  
    use  Doctrine\ORM\Mapping  as  ORM;  
    /**  
     *  @Flow\Entity  
     */  
    class  Car  {  
       /**  
         *  @var  string  
         *  @Flow\Validate('NotEmpty')  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Manufacturer  
         *  @ORM\ManyToOne  
         */  
       protected  $manufacturer;  
    }
    class  Tx_MyExt_Domain_Model_Car  extends    
       Tx_Extbase_DomainObject_AbstractEntity  {  
       /**  
         *  @var  string  
         *  @validate  notempty  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Tx_MyExt_Domain_Model_Manufacturer  
         */  
       protected  $manufacturer;  
    }
    TYPO3 CMS
    (Extbase)
    TYPO3 Flow

    View full-size slide

  20. namespace  My\Ext\Domain\Model;  
    use  TYPO3\Flow\Annotations  as  Flow;  
    use  Doctrine\ORM\Mapping  as  ORM;  
    /**  
     *  @Flow\Entity  
     */  
    class  Car  {  
       /**  
         *  @var  string  
         *  @Flow\Validate('NotEmpty')  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Manufacturer  
         *  @ORM\ManyToOne  
         */  
       protected  $manufacturer;  
    }
    class  Tx_MyExt_Domain_Model_Car  extends    
       Tx_Extbase_DomainObject_AbstractEntity  {  
       /**  
         *  @var  string  
         *  @validate  notempty  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Tx_MyExt_Domain_Model_Manufacturer  
         */  
       protected  $manufacturer;  
    }
    TYPO3 CMS
    (Extbase)
    TYPO3 Flow

    View full-size slide

  21. namespace  My\Ext\Domain\Model;  
    use  TYPO3\Flow\Annotations  as  Flow;  
    use  Doctrine\ORM\Mapping  as  ORM;  
    /**  
     *  @Flow\Entity  
     */  
    class  Car  {  
       /**  
         *  @var  string  
         *  @Flow\Validate('NotEmpty')  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Manufacturer  
         *  @ORM\ManyToOne  
         */  
       protected  $manufacturer;  
    }
    class  Tx_MyExt_Domain_Model_Car  extends    
       Tx_Extbase_DomainObject_AbstractEntity  {  
       /**  
         *  @var  string  
         *  @validate  notempty  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Tx_MyExt_Domain_Model_Manufacturer  
         */  
       protected  $manufacturer;  
    }
    TYPO3 CMS
    (Extbase)
    TYPO3 Flow

    View full-size slide

  22. namespace  My\Ext\Domain\Model;  
    use  TYPO3\Flow\Annotations  as  Flow;  
    use  Doctrine\ORM\Mapping  as  ORM;  
    /**  
     *  @Flow\Entity  
     */  
    class  Car  {  
       /**  
         *  @var  string  
         *  @Flow\Validate('NotEmpty')  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Manufacturer  
         *  @ORM\ManyToOne  
         */  
       protected  $manufacturer;  
    }
    class  Tx_MyExt_Domain_Model_Car  extends    
       Tx_Extbase_DomainObject_AbstractEntity  {  
       /**  
         *  @var  string  
         *  @validate  notempty  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Tx_MyExt_Domain_Model_Manufacturer  
         */  
       protected  $manufacturer;  
    }
    TYPO3 CMS
    (Extbase)
    TYPO3 Flow

    View full-size slide

  23. TYPO3 CMS
    Manual
    Migration
    TYPO3 Flow

    View full-size slide

  24. TYPO3 CMS
    Manual
    Migration
    TYPO3 Flow
    Largely
    unusable

    View full-size slide

  25. TYPO3 CMS TYPO3 Flow
    Double
    maintenance

    View full-size slide

  26. TYPO3 CMS TYPO3 Flow

    View full-size slide

  27. TYPO3 CMS TYPO3 Flow
    Dependencies
    between packages

    View full-size slide

  28. CC BY, Mirko-Tobias Schäfer
    https://www.flickr.com/photos/gastev/2174504149
    Automation

    View full-size slide

  29. https://github.com/
    mittwald/flow-metamorph

    View full-size slide

  30. composer require mittwald-typo3/flow-metamorph
    composer require mittwald-typo3/flow-metamorph-pibase
    Installation

    View full-size slide

  31. class  FooTastic  {  
       public  function  
    hello($who)  {  
           echo  "Hello  
    $who!";  
       }  
    }  
    hello.php
    Input
    Source
    File

    View full-size slide

  32. class  FooTastic  {  
       public  function  
    hello($who)  {  
           echo  "Hello  
    $who!";  
       }  
    }  
    hello.php
    Input
    Source
    File
    Parser

    View full-size slide

  33. class  FooTastic  {  
       public  function  
    hello($who)  {  
           echo  "Hello  
    $who!";  
       }  
    }  
    hello.php
    Input
    Source
    File
    Parser
    Abstract
    Syntax
    Tree

    View full-size slide

  34. class  Tx_MyExt_Domain_Model_Car  extends    
       Tx_Extbase_DomainObject_AbstractEntity  {  
       /**  
         *  @var  string  
         *  @validate  notempty  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Tx_MyExt_Domain_Model_Manufacturer  
         */  
       protected  $manufacturer;  
    }
    Source Code

    View full-size slide

  35. class  Tx_MyExt_Domain_Model_Car  extends    
       Tx_Extbase_DomainObject_AbstractEntity  {  
       /**  
         *  @var  string  
         *  @validate  notempty  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Tx_MyExt_Domain_Model_Manufacturer  
         */  
       protected  $manufacturer;  
    }
    class
    name=Tx_..._Car
    abstract=false
    final=false
    extends
    name=Tx_..._AbstractEntity
    stmts
    property
    name=licenseNumber
    docComment="/**\n..."
    property
    name=manufacturer
    docComment="/**\n..."
    Source Code Syntax Tree

    View full-size slide

  36. class  FooTastic  {  
       public  function  
    hello($who)  {  
           echo  "Hello  
    $who!";  
       }  
    }  
    hello.php
    Input
    Source
    File
    Parser
    Abstract
    Syntax
    Tree

    View full-size slide

  37. class  FooTastic  {  
       public  function  
    hello($who)  {  
           echo  "Hello  
    $who!";  
       }  
    }  
    hello.php
    Input
    Source
    File
    Parser
    Transformation
    Rules
    Trans-
    former
    Abstract
    Syntax
    Tree

    View full-size slide

  38. class  FooTastic  {  
       public  function  
    hello($who)  {  
           echo  "Hello  
    $who!";  
       }  
    }  
    hello.php
    Input
    Source
    File
    Parser
    Transformation
    Rules
    Trans-
    former
    Printer
    namespace  Foo;  
    class  FooTastic  {  
       /**  @Flow\Inject  */  
       protected  $greeter;  
       public  function  
    hello($who)  {  
           $this-­‐>greeter-­‐
    >greet($who);  
       }
    hello_improved.php
    output
    Source
    File(s)
    Abstract
    Syntax
    Tree

    View full-size slide

  39. class  FooTastic  {  
       public  function  
    hello($who)  {  
           echo  "Hello  
    $who!";  
       }  
    }  
    hello.php
    Input
    Source
    File
    Parser
    class  FooTastic:  
       def  hello(who):  
           print  "Hello  %s"\  
                                   %  who  
    hello.py
    Transformation
    Rules
    Trans-
    former
    Printer
    namespace  Foo;  
    class  FooTastic  {  
       /**  @Flow\Inject  */  
       protected  $greeter;  
       public  function  
    hello($who)  {  
           $this-­‐>greeter-­‐
    >greet($who);  
       }
    hello_improved.php
    output
    Source
    File(s)
    Abstract
    Syntax
    Tree

    View full-size slide

  40. namespace  My\Ext\Domain\Model;  
    use  TYPO3\Flow\Annotations  as  Flow;  
    use  Doctrine\ORM\Mapping  as  ORM;  
    /**  
     *  @Flow\Entity  
     */  
    class  Car  {  
       /**  
         *  @var  string  
         *  @Flow\Validate('NotEmpty')  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Manufacturer  
         *  @ORM\ManyToOne  
         */  
       protected  $manufacturer;  
    }
    class  Tx_MyExt_Domain_Model_Car  extends    
       Tx_Extbase_DomainObject_AbstractEntity  {  
       /**  
         *  @var  string  
         *  @validate  notempty  
         */  
       protected  $licenseNumber;  
       /**  
         *  @var  Tx_MyExt_Domain_Model_Manufacturer  
         */  
       protected  $manufacturer;  
    }
    TYPO3 CMS
    (Extbase)
    TYPO3 Flow

    View full-size slide

  41. namespace
    name=Mw\MyExt\Domain\Model
    uses
    use
    name=Mw\...\AbstractVehicle
    alias=AbstractVehicle
    stmts
    class
    name=Car
    abstract=false
    final=false
    extends
    name=AbstractVehicle
    stmts
    BEFORE
    AFTER
    „Rename
    Tx_MyExt_Domain_Model_Car
    to
    Mw\MyExt\Domain\Model\Car“
    class
    name=Tx_..._Car
    abstract=false
    final=false
    extends
    name=Tx_..._AbstractVehicle
    stmts
    property
    name=licenseNumber
    docComment="/**\n..."
    property
    name=manufacturer
    docComment="/**\n..."

    View full-size slide

  42. TYPO3 CMS TYPO3 Flow
    Compatibility
    Automated
    Migration

    View full-size slide

  43. TYPO3 CMS
    Old Code, but
    Feature Complete
    TYPO3 Flow
    Compatibility
    Automated
    Migration

    View full-size slide

  44. TYPO3 Flow
    Compatibility
    TYPO3 CMS
    Rewrite
    iteratively

    View full-size slide

  45. TYPO3 Flow
    Compatibility
    TYPO3 CMS
    Rewrite
    iteratively New
    features

    View full-size slide

  46. Compatibility
    TYPO3 CMS
    Rewrite
    iteratively
    Decomission the
    old Application
    TYPO3 Flow

    View full-size slide

  47. TYPO3 Flow
    Compatibility
    TYPO3 CMS
    Rewrite
    iteratively
    Migrate
    continuously
    Continue to maintain
    old Application

    View full-size slide

  48. Automated
    Code Transformation
    Merge
    Manual
    correction

    View full-size slide

  49. Open Problems
    Proof of correctness
    „How do I know that the
    auto-generated code is
    correct?“

    View full-size slide

  50. Open Problems
    Ease of Extensibility
    „I want to migrate from Zend
    to Flow, but writing new
    transformation rules is just too
    complex!“

    View full-size slide

  51. Open Problems
    Efficiency
    „Wouldn’t it be easier to just
    migrate all my code by hand?“

    View full-size slide

  52. CC BY-SA, Max Mustermann
    http://mustermann.de

    View full-size slide

  53. http://slideshare.net/mhelmich/migrating-from-typo3-
    cms-to-typo3-flow
    https://speakerdeck.com/kdambekalns/migrating-
    from-typo3-cms-to-typo3-neos
    Resources

    View full-size slide

  54. Thank you
    This work is licensed under a Creative Commons Attribution-
    ShareAlike 4.0 International License.
    [email protected]
    @martin-helmich
    https://github.com/martin-helmich
    https://github.com/mittwald/flow-metamorph

    View full-size slide