T3CON14EU: Migrating from TYPO3 CMS to TYPO3 Flow

T3CON14EU: Migrating from TYPO3 CMS to TYPO3 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 is still presents a challenge due to large conceptual differences between the two systems.

This talk aims at presenting an approach how a (semi) automated migration of TYPO3 CMS to TYPO3 Flow and Neos could be achieved.

2b68bc93708466a655a4c60458dc7955?s=128

Martin Helmich

October 09, 2014
Tweet

Transcript

  1. 1.

    Migrating from TYPO3 CMS to TYPO3 Flow 10th International TYPO3

    Conference, October 9th, Berlin CC BY Serge Melki https://www.flickr.com/photos/sergemelki/8156340258 Martin Helmich m.helmich@mittwald.de
  2. 2.
  3. 3.
  4. 14.

    although... page  =  PAGE   page  {      

     10  =  TEMPLATE      10  {          template  =  FILE          template.file  =  fileadmin/site.html            marks  {              CONTENT  <  styles.content.get              CONTENT_RIGHT  <  styles.content.getRight          }      }     }   page  =  TYPO3.Neos:Page  {      body  {          templatePath  =   'resource://My.Site/.../Site.html'            content  {              main  =  PrimaryContent  {                  nodePath  =  'main'              }              right  =  ContentCollection  {                  nodePath  =  'right'              }          }            
  5. 17.

    TYPO3 CMS (Extbase) TYPO3 Flow ? Classes/ Controller/ Domain/ …

    Configuration/ TypoScript/ TCA/ Resources/ Public/ Private/ ext_emconf.php ext_tables.php ext_tables.sql Classes/ Controller/ Domain/ … Configuration/ Migrations/ Mysql/ Resources/ Public/ Private/ composer.json
  6. 18.

    TYPO3 CMS (Extbase) TYPO3 Flow 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;   }   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;   }  
  7. 19.

    TYPO3 CMS (Extbase) TYPO3 Flow 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;   }   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;   }   Namespacify classes when necessary
  8. 20.

    TYPO3 CMS (Extbase) TYPO3 Flow 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;   }   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;   }   Determine domain object type by class inheritance and add annotation
  9. 21.

    TYPO3 CMS (Extbase) TYPO3 Flow 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;   }   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;   }   Convert annotations.
  10. 22.

    TYPO3 CMS (Extbase) TYPO3 Flow 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;   }   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;   }   Determine association cardinality from TCA
  11. 23.

    some other stuff to think about usage of TYPO3 APIs

    (aka. the infamous t3lib_div) Convert locallang to XLIFF create doctrine migrations from ext_tables.sql domain models extending TYPO3 classes different value object handling
  12. 25.

    TYPO3 CMS (pibase) TYPO3 Flow lib/ pi1/ class.tx_myext_pi1.php static/ res/

    ext_emconf.php ext_tables.php ext_tables.sql Classes/ Controller/ Domain/ Plugin/ … Configuration/ Migrations/ Mysql/ Resources/ Public/ Private/ composer.json ?
  13. 26.

    class  tx_myext_pi1  extends  tslib_pibase  {      public  function  main($conf,

     $content)  {          $mainTemplate  =  $this-­‐>cObj-­‐>fileResource(...);          $rowTemplate    =  $this-­‐>cObj-­‐>fileResource(...);          $userRes  =  $GLOBALS['TYPO3_DB']-­‐>exec_SELECTquery(              '*',  'tx_myext_users',  'deleted=0  AND  active=1'          );          while($user  =  $GLOBALS['TYPO3_DB']-­‐>sql_fetch_assoc($userRes))  {              $markers  =  [                  "###NAME###"    =>  $user['name'],                  "###EMAIL###"  =>  $user['email']              ];              $content  .=  $this-­‐>cObj-­‐>substituteMarkerArray(                  $rowTemplate,  $markers              );          }            $markers  =  ['###USERS###'  =>  $content];          return  $this-­‐>cObj-­‐>substituteMarkerArray($mainTemplate,  $markers);      }   }  
  14. 27.

    Doctrine 2 DBAL Doctrine 2 ORM Flow Resource Mgmt. Flow

    MVC Stack Pain abstraction layer The world of pain (old code)
  15. 28.

    namespace  My\Ext\Plugin;   class  UserListPlugin  extends  \Mw\T3Compat\Plugin\BasePlugin  {    

     public  function  main($conf,  $content)  {          $mainTemplate  =  $this-­‐>cObj-­‐>fileResource(...);          $rowTemplate    =  $this-­‐>cObj-­‐>fileResource(...);          $userRes  =  $this-­‐>database-­‐>exec_SELECTquery(              '*',  'tx_myext_users',  'deleted=0  AND  active=1'          );          while($user  =  $this-­‐>database-­‐>sql_fetch_assoc($userRes))  {              $markers  =  [                  "###NAME###"    =>  $user['name'],                  "###EMAIL###"  =>  $user['email']              ];              $content  .=  $this-­‐>cObj-­‐>substituteMarkerArray(                  $rowTemplate,  $markers              );          }            $markers  =  ['###USERS###'  =>  $content];          return  $this-­‐>cObj-­‐>substituteMarkerArray($mainTemplate,  $markers);      }   }  
  16. 29.
  17. 32.