Slide 1

Slide 1 text

Symfony Catalunya 2016 How PrestaShop started the migration to Symfony Symfony Catalunya 2016

Slide 2

Slide 2 text

Symfony Catalunya 2016 How PrestaShop started the migration to Symfony Symfony Catalunya 2016

Slide 3

Slide 3 text

Symfony Catalunya 2016 Overview of PrestaShop

Slide 4

Slide 4 text

Symfony Catalunya 2016 What is PrestaShop?

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

Symfony Catalunya 2016 What is PrestaShop? • Open source e-commerce solution • Project started in 2007

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

Symfony Catalunya 2016 Why did we migrate to Symfony?

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

Symfony Catalunya 2016 Why did we migrate to Symfony?

Slide 21

Slide 21 text

Symfony Catalunya 2016 Why did we migrate to Symfony? Why not a PrestaShop v2?

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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!

Slide 25

Slide 25 text

Symfony Catalunya 2016 The migration!

Slide 26

Slide 26 text

Symfony Catalunya 2016 Step #1 Allow Symfony to handle the requests

Slide 27

Slide 27 text

Symfony Catalunya 2016 Allow Symfony to handle the requests

Slide 28

Slide 28 text

Symfony Catalunya 2016 Allow Symfony to handle the requests

Slide 29

Slide 29 text

Symfony Catalunya 2016 Allow Symfony to handle the requests

Slide 30

Slide 30 text

Symfony Catalunya 2016 Allow Symfony to handle the requests From the Symfony API documentation:

Slide 31

Slide 31 text

Symfony Catalunya 2016 Allow Symfony to handle the requests

Slide 32

Slide 32 text

Symfony Catalunya 2016 Allow Symfony to handle the requests

Slide 33

Slide 33 text

Symfony Catalunya 2016 Step #2 Learn the Adapter design pattern

Slide 34

Slide 34 text

Symfony Catalunya 2016 Learn the Adapter design pattern What is an Adapter?

Slide 35

Slide 35 text

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.

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

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

Slide 39

Slide 39 text

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

Slide 40

Slide 40 text

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

Slide 41

Slide 41 text

Symfony Catalunya 2016 Learn the Adapter design pattern

Slide 42

Slide 42 text

Symfony Catalunya 2016 Learn the Adapter design pattern

Slide 43

Slide 43 text

Symfony Catalunya 2016 Step #3 Overriding a service with an adapter

Slide 44

Slide 44 text

Symfony Catalunya 2016 Overriding a service with an adapter • Custom translation system

Slide 45

Slide 45 text

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

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

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

Slide 48

Slide 48 text

Symfony Catalunya 2016 Overriding a service with an adapter Legacy sources Adapters Symfony AppBundle Extends Use Register services

Slide 49

Slide 49 text

Symfony Catalunya 2016 Overriding a service with an adapter

Slide 50

Slide 50 text

Symfony Catalunya 2016 Overriding a service with an adapter

Slide 51

Slide 51 text

Symfony Catalunya 2016 Overriding a service with an adapter

Slide 52

Slide 52 text

Symfony Catalunya 2016 Overriding a service with an adapter

Slide 53

Slide 53 text

Symfony Catalunya 2016 Overriding a service with an adapter

Slide 54

Slide 54 text

Symfony Catalunya 2016 Overriding a service with an adapter

Slide 55

Slide 55 text

Symfony Catalunya 2016 Step #4 Understand the 3 steps architecture

Slide 56

Slide 56 text

Symfony Catalunya 2016 Understand the 3 steps architecture

Slide 57

Slide 57 text

Symfony Catalunya 2016 Understand the 3 steps architecture Symfony AppBundle

Slide 58

Slide 58 text

Symfony Catalunya 2016 Understand the 3 steps architecture Legacy sources Symfony AppBundle

Slide 59

Slide 59 text

Symfony Catalunya 2016 Understand the 3 steps architecture Legacy sources Symfony AppBundle Adapters

Slide 60

Slide 60 text

Symfony Catalunya 2016 Understand the 3 steps architecture Legacy sources Symfony AppBundle Will be removed Adapters

Slide 61

Slide 61 text

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

Slide 62

Slide 62 text

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

Slide 63

Slide 63 text

Symfony Catalunya 2016 There is still much to do!

Slide 64

Slide 64 text

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

Slide 65

Slide 65 text

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

Slide 66

Slide 66 text

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

Slide 67

Slide 67 text

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

Slide 68

Slide 68 text

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?

Slide 69

Slide 69 text

Symfony Catalunya 2016 Julien Martin @shudrum Shudrum We’re Hiring! [email protected]