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

How PrestaShop started the migration to Symfony

How PrestaShop started the migration to Symfony

My small talk for the Symfony Catalunya 2016 event where I've showed how PrestaShop started the migration to Symfony with some easy steps.

Julien Martin

July 23, 2016
Tweet

More Decks by Julien Martin

Other Decks in Programming

Transcript

  1. Symfony Catalunya 2016 What is PrestaShop? • Open source e-commerce

    solution • Project started in 2007 • Used by 250,000 shops worldwide
  2. Symfony Catalunya 2016 What is PrestaShop? • Open source e-commerce

    solution • Project started in 2007 • Used by 250,000 shops worldwide • Available in 60 different languages
  3. Symfony Catalunya 2016 What is PrestaShop? • Open source e-commerce

    solution • Project started in 2007 • Used by 250,000 shops worldwide • Available in 60 different languages • More than 600 features by default
  4. Symfony Catalunya 2016 What is PrestaShop? • Open source e-commerce

    solution • Project started in 2007 • Used by 250,000 shops worldwide • Available in 60 different languages • More than 600 features by default • 3,500 modules available on the marketplace
  5. Symfony Catalunya 2016 What is PrestaShop? • Open source e-commerce

    solution • Project started in 2007 • Used by 250,000 shops worldwide • Available in 60 different languages • More than 600 features by default • 3,500 modules available on the marketplace • 2,000 themes
  6. Symfony Catalunya 2016 What is PrestaShop? • 40,000 lines of

    code for templates • 30,000 lines of code for javascript
  7. Symfony Catalunya 2016 What is PrestaShop? • 40,000 lines of

    code for templates • 30,000 lines of code for javascript • 230,000 lines of code for PHP
  8. Symfony Catalunya 2016 Why did we migrate to Symfony? •

    Maintaining our framework costs time
  9. Symfony Catalunya 2016 Why did we migrate to Symfony? •

    Maintaining our framework costs time • This is not our job!
  10. Symfony Catalunya 2016 Why did we migrate to Symfony? •

    Maintaining our framework costs time • This is not our job! • We must focus on the e-commerce
  11. Symfony Catalunya 2016 Why did we migrate to Symfony? •

    Maintaining our framework costs time • This is not our job! • We must focus on the e-commerce • The reputation & the community
  12. Symfony Catalunya 2016 Why did we migrate to Symfony? Why

    not a PrestaShop v2? • Re-creating the 600 features will take too much time
  13. Symfony Catalunya 2016 Why did we migrate to Symfony? Why

    not a PrestaShop v2? • Re-creating the 600 features will take too much time • We don’t want to break themes & modules compatibility
  14. Symfony Catalunya 2016 Why did we migrate to Symfony? Why

    not a PrestaShop v2? • Re-creating the 600 features will take too much time • We don’t want to break themes & modules compatibility • We cannot stop our business for years!
  15. Symfony Catalunya 2016 Learn the Adapter design pattern What is

    an Adapter? The adapter pattern allows the interface of an existing class to be used as another interface.
  16. Symfony Catalunya 2016 Learn the Adapter design pattern Price ________________

    +getProductPrice() Legacy sources Product ________________ +getBasePrice()
  17. Symfony Catalunya 2016 Learn the Adapter design pattern Product ________________

    +getPrice() Symfony AppBundle Price ________________ +getProductPrice() Legacy sources Product ________________ +getBasePrice()
  18. Symfony Catalunya 2016 Learn the Adapter design pattern Product ________________

    +getPrice() Symfony AppBundle Price ________________ +getProductPrice() Legacy sources Product ________________ +getBasePrice() ProductAdapter ________________ +getPrice() Adapters
  19. Symfony Catalunya 2016 Learn the Adapter design pattern Product ________________

    +getPrice() Symfony AppBundle Price ________________ +getProductPrice() Legacy sources Product ________________ +getBasePrice() ProductAdapter ________________ +getPrice() Adapters
  20. Symfony Catalunya 2016 Learn the Adapter design pattern Product ________________

    +getPrice() Symfony AppBundle Price ________________ +getProductPrice() Legacy sources Product ________________ +getBasePrice() ProductAdapter ________________ +getPrice() Adapters
  21. Symfony Catalunya 2016 Overriding a service with an adapter •

    Custom translation system • Start to use the Symfony Translator …
  22. Symfony Catalunya 2016 Overriding a service with an adapter •

    Custom translation system • Start to use the Symfony Translator … • … to remove the old one
  23. Symfony Catalunya 2016 Overriding a service with an adapter Legacy

    sources Adapters Symfony AppBundle Extends Use
  24. Symfony Catalunya 2016 Overriding a service with an adapter Legacy

    sources Adapters Symfony AppBundle Extends Use Register services
  25. Symfony Catalunya 2016 Understand the 3 steps architecture Legacy sources

    Symfony AppBundle Will be removed Use The legacy sources and the adapters can use and be dependent of any sources. Use Use Adapters
  26. Symfony Catalunya 2016 Understand the 3 steps architecture Legacy sources

    Symfony AppBundle Will be removed Extends Register Services The symfony sources will never directly use an adapter or a legacy source. Use The legacy sources and the adapters can use and be dependent of any sources. Use Use Adapters
  27. Symfony Catalunya 2016 There is still much to do! •

    From your template engine to Twig
  28. Symfony Catalunya 2016 There is still much to do! •

    From your template engine to Twig • Unit testing!!!
  29. Symfony Catalunya 2016 There is still much to do! •

    From your template engine to Twig • Unit testing!!! • Double database writing
  30. Symfony Catalunya 2016 There is still much to do! •

    From your template engine to Twig • Unit testing!!! • Double database writing • Rethink your processes
  31. Symfony Catalunya 2016 There is still much to do! •

    From your template engine to Twig • Unit testing!!! • Double database writing • Rethink your processes • Why not an API?