Back-end with SonataAdminBundle (and Symfony2, of course...)

Andrea Delfino
Andrea DelfinoSenior Software Engineer presso eBay Inc at eBay
BACK-END WITH

     SONATA ADMIN BUNDLE
                       AND SYMFONY2, OF COURSE...

                            Andrea Delfino
                            andrea.delfino@gmail.com




             SYMFONYDAY 2012
sabato 6 ottobre 12
•Developer with 10+ years experience
                      •Either SysAdmin (DevOps ❤)
                      •Actually working for Skuola.net
                      •I love Free Software (free as in freedom)
                      •Knowledge sharing (Web, LUG, ..., PUG)

                                           @ottimo
                              https://github.com/andreadelfino

                             PUG Turin: http://torino.grusp.org



             SYMFONYDAY 2012
sabato 6 ottobre 12
THE PROBLEM
                                          TIME
                  Often we have little time for developing the back-end




             SYMFONYDAY 2012
sabato 6 ottobre 12
THE PROBLEM
                                       EXPECTATIONS
                      We're migrating from an CMS with a good back-end




             SYMFONYDAY 2012
sabato 6 ottobre 12
THE SOLUTION

                           X
                      phpMyAdmin

             SYMFONYDAY 2012
sabato 6 ottobre 12
ALTERNATIVE

                      • Homebrew
                      • Altri Framework
                      • SF2/Doctrine CRUD Generator
                      • AdmingeneratorGeneratorBundle
                      • WhiteOctoberAdminBundle
                      • FooSimpleAdminBundle (one-dev-bundle)



             SYMFONYDAY 2012
sabato 6 ottobre 12
OR...

                      SonataAdminBundle
                          “Admin is not only about Model; but about providing a
                      consistent and rich user experience for managing data.”
                                                                    Thomas Rabaix




             SYMFONYDAY 2012
sabato 6 ottobre 12
SONATA PROJECT
                                      http://sonata-project.org



                      • Mantainer: Thomas Rabaix (https://github.com/rande)
                      • Sponsor: Ekino (http://www.ekino.com)
                      • Obiettivo: e-commerce framework
                      • State: 13 bundles e some libraries




             SYMFONYDAY 2012
sabato 6 ottobre 12
FEATURES OVERVIEW
                 Dashboard                                             Templating
                                                                       •Base templates (field, list, filter) can be overwritten
                 List                                                  •Layout templates can be defined into the Service
                 •Automatic sort                                        Container
                 •Link to associated admin (Post => User)
                 •Custom templates                                     Others
                 •Row Action: edit, create, view, ...                  •Nested Admin (ie: /news/post/5/comment/list filter
                 •Batch Action                                          and create comments only for the post with id=5)
                 •Clever row visualisation: boolean values are         •Contextual Breadcrumb
                  represented with 'check picture'                     •Persistent parameters across an Admin
                 •Filter                                               •Side menu option
                 •Pagination                                           •Translated into 17 languages: CA, DE, EN, ES, FR, HR,
                                                                        IT, JA, LB, NL, PL, PT_BR, PT_PT, RU, SK, SL and UK
                 Edit / Create                                         •Built to be extended
                 •Inline edition                                       •Explain command line utility
                 •Association management (create related model with
                  + icon)                                              Bundles (on top of)
                 •Group fields                                          •SonataMediaBundle: a media manager bundle
                 •Sortable option                                      •SonataNewsBundle: a news/blog bundle
                 •Modal window to select model (when the list can be   •SonataPageBundle: a page (CMS like) bundle
                  important)                                           •SonataUserBundle: integration of FOSUserBundle and
                 •Dynamic form on [one|many]-to-many association        SonataAdminBundle
                  (add new element)




             SYMFONYDAY 2012
sabato 6 ottobre 12
ECOSYSTEM
                                     Symfony Framework
                                    Symfony Components
           SonataCacheBundle                                                  SonataPageBundle
            SonataBlockBundle                                                SonataNewsBundle
           SonataJQueryBundle                                                SonataMediaBundle
             KnpMenuBundle                                                    SonataUserBundle
                Exporter           SonataAdminBundle                            Symfony CMF
                                     abstract class Admin


               SonataDoctrineORMAdmin   SonataDoctrineMongoDBAdmin   SonataDoctrinePhpcrAdmin




             SYMFONYDAY 2012
sabato 6 ottobre 12
INSTALLATION


                • vi deps && vendors install (branch/2.0 + sf2.0)
                • composer (master + sf2.1)




             SYMFONYDAY 2012
sabato 6 ottobre 12
CONFIGURATION


                      • autoload.php + AppKernel.php
                      • config.yml + routing.yml




             SYMFONYDAY 2012
sabato 6 ottobre 12
MAYBE NOT EVERYONE KNOWS THAT...

                             In Bundle               Standalone
                      src/                     src/
                         Skuola/                  Skuola/
                           UniversitaBundle/        AdminBundle/
                               Admin/                   Admin/
                           VersioniBundle/          UniversitaBundle/
                               Admin/               VersioniBundle/
                           ...                      ...

                          skuola.net/admin         admin.skuola.net



             SYMFONYDAY 2012
sabato 6 ottobre 12
ADMIN CLASS
                          Class as a Service

          Service                              Our Admin class




                                      Entity




            Admin pool    Dashboard            Controller
                            group
             SYMFONYDAY 2012
sabato 6 ottobre 12
DASHBOARD
                                                   Twitter
                                 Quick actions   Bootstrap ;)




                      Entities
                                                 }Group




             SYMFONYDAY 2012
sabato 6 ottobre 12
Filters
                         LIST VIEW
                        Custom fields                   Actions




                            Export


                                       Batch actions

             SYMFONYDAY 2012
sabato 6 ottobre 12
LIST VIEW




             SYMFONYDAY 2012
sabato 6 ottobre 12
LIST VIEW
                                    Admin class

                          List Mapper


                                          Custom Template



                                             Custom Actions




             SYMFONYDAY 2012
sabato 6 ottobre 12
LIST VIEW


                                         Actions Route


                                     Filters




             SYMFONYDAY 2012
sabato 6 ottobre 12
EDIT / CREATE FORM
                         Associated Entity

                                         Properties
                                                       Entity Collection
                                                      (ManyToMany with
                                                         extra fields)



                                                       Help inline

                                       CRUD Actions
             SYMFONYDAY 2012
sabato 6 ottobre 12
EDIT / CREATE FORM
       Modal windows ;)
                                          List View



                      Opera




          Click to choose
            association




             SYMFONYDAY 2012
sabato 6 ottobre 12
EDIT / CREATE FORM
                                                  Create Form



          Etichette




                      Creating a new associated Entity


             SYMFONYDAY 2012
sabato 6 ottobre 12
EDIT / CREATE FORM
                           Form Mapper

                                  Model type

                                                  Collection type


                                         Custom visualization


                                           Help inline



             SYMFONYDAY 2012
sabato 6 ottobre 12
MAYBE NOT EVERYONE KNOWS THAT...


                                           Form fields template




                                              Custom field block




             SYMFONYDAY 2012
sabato 6 ottobre 12
OTHER FEATURES
                      •Controller for custom and batch actions
                      •Lifecycle Callbacks
                      •Validation
                      •Advanced Templates customization
                      •Pagination
                      •Sidebar & Menu (via KnpMenuBundle)
                      •Translations (10+ languages, Italian included)
                      •ACL / Security Layer (SonataUserBundle + FOSUserBundle)
                      •CLI Utility (app/console sonata:admin:*)
                          http://sonata-project.org/bundles/admin/2-0/doc/index.html



             SYMFONYDAY 2012
sabato 6 ottobre 12
CONCLUSIONI
                      • Very powerful and flexible
                      • Active community (>260 fork, >50 contrib)

                      •Stable release nearsometimesbut still missing
                                           for sf2.0...
                      • Documentation is                lacking

                      • Unstable “master” version (for sf2.1)


                          Being a Good OSS Contributor - Jeremy Mikola (http://joind.in/talk/view/7216)




             SYMFONYDAY 2012
sabato 6 ottobre 12
Questions?


             SYMFONYDAY 2012
sabato 6 ottobre 12
Grazie
                                       So long, and thanks for all the fish! ;)




                                              @ottimo
                                 https://github.com/andreadelfino

                                      andrea.delfino@gmail.com



                      Thanks to Thomas Rabaix (@th0masr) for support and Lineke Kerckhoffs-
                                    Willems (@the_linie) for presentation tips.



             SYMFONYDAY 2012
sabato 6 ottobre 12
1 of 28

More Related Content

What's hot(20)

Similar to Back-end with SonataAdminBundle (and Symfony2, of course...)(20)

Recently uploaded(20)

ChatGPT and AI for Web DevelopersChatGPT and AI for Web Developers
ChatGPT and AI for Web Developers
Maximiliano Firtman152 views
CXL at OCPCXL at OCP
CXL at OCP
CXL Forum183 views
The Research Portal of Catalonia: Growing more (information) & more (services)The Research Portal of Catalonia: Growing more (information) & more (services)
The Research Portal of Catalonia: Growing more (information) & more (services)
CSUC - Consorci de Serveis Universitaris de Catalunya51 views
Java Platform Approach 1.0 - Picnic MeetupJava Platform Approach 1.0 - Picnic Meetup
Java Platform Approach 1.0 - Picnic Meetup
Rick Ossendrijver23 views
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh34 views

Back-end with SonataAdminBundle (and Symfony2, of course...)

  • 1. BACK-END WITH SONATA ADMIN BUNDLE AND SYMFONY2, OF COURSE... Andrea Delfino andrea.delfino@gmail.com SYMFONYDAY 2012 sabato 6 ottobre 12
  • 2. •Developer with 10+ years experience •Either SysAdmin (DevOps ❤) •Actually working for Skuola.net •I love Free Software (free as in freedom) •Knowledge sharing (Web, LUG, ..., PUG) @ottimo https://github.com/andreadelfino PUG Turin: http://torino.grusp.org SYMFONYDAY 2012 sabato 6 ottobre 12
  • 3. THE PROBLEM TIME Often we have little time for developing the back-end SYMFONYDAY 2012 sabato 6 ottobre 12
  • 4. THE PROBLEM EXPECTATIONS We're migrating from an CMS with a good back-end SYMFONYDAY 2012 sabato 6 ottobre 12
  • 5. THE SOLUTION X phpMyAdmin SYMFONYDAY 2012 sabato 6 ottobre 12
  • 6. ALTERNATIVE • Homebrew • Altri Framework • SF2/Doctrine CRUD Generator • AdmingeneratorGeneratorBundle • WhiteOctoberAdminBundle • FooSimpleAdminBundle (one-dev-bundle) SYMFONYDAY 2012 sabato 6 ottobre 12
  • 7. OR... SonataAdminBundle “Admin is not only about Model; but about providing a consistent and rich user experience for managing data.” Thomas Rabaix SYMFONYDAY 2012 sabato 6 ottobre 12
  • 8. SONATA PROJECT http://sonata-project.org • Mantainer: Thomas Rabaix (https://github.com/rande) • Sponsor: Ekino (http://www.ekino.com) • Obiettivo: e-commerce framework • State: 13 bundles e some libraries SYMFONYDAY 2012 sabato 6 ottobre 12
  • 9. FEATURES OVERVIEW Dashboard Templating •Base templates (field, list, filter) can be overwritten List •Layout templates can be defined into the Service •Automatic sort Container •Link to associated admin (Post => User) •Custom templates Others •Row Action: edit, create, view, ... •Nested Admin (ie: /news/post/5/comment/list filter •Batch Action and create comments only for the post with id=5) •Clever row visualisation: boolean values are •Contextual Breadcrumb represented with 'check picture' •Persistent parameters across an Admin •Filter •Side menu option •Pagination •Translated into 17 languages: CA, DE, EN, ES, FR, HR, IT, JA, LB, NL, PL, PT_BR, PT_PT, RU, SK, SL and UK Edit / Create •Built to be extended •Inline edition •Explain command line utility •Association management (create related model with + icon) Bundles (on top of) •Group fields •SonataMediaBundle: a media manager bundle •Sortable option •SonataNewsBundle: a news/blog bundle •Modal window to select model (when the list can be •SonataPageBundle: a page (CMS like) bundle important) •SonataUserBundle: integration of FOSUserBundle and •Dynamic form on [one|many]-to-many association SonataAdminBundle (add new element) SYMFONYDAY 2012 sabato 6 ottobre 12
  • 10. ECOSYSTEM Symfony Framework Symfony Components SonataCacheBundle SonataPageBundle SonataBlockBundle SonataNewsBundle SonataJQueryBundle SonataMediaBundle KnpMenuBundle SonataUserBundle Exporter SonataAdminBundle Symfony CMF abstract class Admin SonataDoctrineORMAdmin SonataDoctrineMongoDBAdmin SonataDoctrinePhpcrAdmin SYMFONYDAY 2012 sabato 6 ottobre 12
  • 11. INSTALLATION • vi deps && vendors install (branch/2.0 + sf2.0) • composer (master + sf2.1) SYMFONYDAY 2012 sabato 6 ottobre 12
  • 12. CONFIGURATION • autoload.php + AppKernel.php • config.yml + routing.yml SYMFONYDAY 2012 sabato 6 ottobre 12
  • 13. MAYBE NOT EVERYONE KNOWS THAT... In Bundle Standalone src/ src/ Skuola/ Skuola/ UniversitaBundle/ AdminBundle/ Admin/ Admin/ VersioniBundle/ UniversitaBundle/ Admin/ VersioniBundle/ ... ... skuola.net/admin admin.skuola.net SYMFONYDAY 2012 sabato 6 ottobre 12
  • 14. ADMIN CLASS Class as a Service Service Our Admin class Entity Admin pool Dashboard Controller group SYMFONYDAY 2012 sabato 6 ottobre 12
  • 15. DASHBOARD Twitter Quick actions Bootstrap ;) Entities }Group SYMFONYDAY 2012 sabato 6 ottobre 12
  • 16. Filters LIST VIEW Custom fields Actions Export Batch actions SYMFONYDAY 2012 sabato 6 ottobre 12
  • 17. LIST VIEW SYMFONYDAY 2012 sabato 6 ottobre 12
  • 18. LIST VIEW Admin class List Mapper Custom Template Custom Actions SYMFONYDAY 2012 sabato 6 ottobre 12
  • 19. LIST VIEW Actions Route Filters SYMFONYDAY 2012 sabato 6 ottobre 12
  • 20. EDIT / CREATE FORM Associated Entity Properties Entity Collection (ManyToMany with extra fields) Help inline CRUD Actions SYMFONYDAY 2012 sabato 6 ottobre 12
  • 21. EDIT / CREATE FORM Modal windows ;) List View Opera Click to choose association SYMFONYDAY 2012 sabato 6 ottobre 12
  • 22. EDIT / CREATE FORM Create Form Etichette Creating a new associated Entity SYMFONYDAY 2012 sabato 6 ottobre 12
  • 23. EDIT / CREATE FORM Form Mapper Model type Collection type Custom visualization Help inline SYMFONYDAY 2012 sabato 6 ottobre 12
  • 24. MAYBE NOT EVERYONE KNOWS THAT... Form fields template Custom field block SYMFONYDAY 2012 sabato 6 ottobre 12
  • 25. OTHER FEATURES •Controller for custom and batch actions •Lifecycle Callbacks •Validation •Advanced Templates customization •Pagination •Sidebar & Menu (via KnpMenuBundle) •Translations (10+ languages, Italian included) •ACL / Security Layer (SonataUserBundle + FOSUserBundle) •CLI Utility (app/console sonata:admin:*) http://sonata-project.org/bundles/admin/2-0/doc/index.html SYMFONYDAY 2012 sabato 6 ottobre 12
  • 26. CONCLUSIONI • Very powerful and flexible • Active community (>260 fork, >50 contrib) •Stable release nearsometimesbut still missing for sf2.0... • Documentation is lacking • Unstable “master” version (for sf2.1) Being a Good OSS Contributor - Jeremy Mikola (http://joind.in/talk/view/7216) SYMFONYDAY 2012 sabato 6 ottobre 12
  • 27. Questions? SYMFONYDAY 2012 sabato 6 ottobre 12
  • 28. Grazie So long, and thanks for all the fish! ;) @ottimo https://github.com/andreadelfino andrea.delfino@gmail.com Thanks to Thomas Rabaix (@th0masr) for support and Lineke Kerckhoffs- Willems (@the_linie) for presentation tips. SYMFONYDAY 2012 sabato 6 ottobre 12

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. \n
  107. \n
  108. \n
  109. \n
  110. \n
  111. \n
  112. \n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. \n
  123. \n
  124. \n
  125. \n
  126. \n
  127. \n
  128. \n
  129. \n
  130. \n
  131. \n
  132. \n
  133. \n