Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

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

25,539 views

Published on

A brief overview on how build administration panels with SonataAdminBundle for Symfony2 php framework. (SymfonyDay Italia 2012 - 5 Oct 2012)

Published in: Technology
  • Be the first to comment

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

  1. 1. BACK-END WITH SONATA ADMIN BUNDLE AND SYMFONY2, OF COURSE... Andrea Delfino andrea.delfino@gmail.com SYMFONYDAY 2012sabato 6 ottobre 12
  2. 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 2012sabato 6 ottobre 12
  3. 3. THE PROBLEM TIME Often we have little time for developing the back-end SYMFONYDAY 2012sabato 6 ottobre 12
  4. 4. THE PROBLEM EXPECTATIONS Were migrating from an CMS with a good back-end SYMFONYDAY 2012sabato 6 ottobre 12
  5. 5. THE SOLUTION X phpMyAdmin SYMFONYDAY 2012sabato 6 ottobre 12
  6. 6. ALTERNATIVE • Homebrew • Altri Framework • SF2/Doctrine CRUD Generator • AdmingeneratorGeneratorBundle • WhiteOctoberAdminBundle • FooSimpleAdminBundle (one-dev-bundle) SYMFONYDAY 2012sabato 6 ottobre 12
  7. 7. OR... SonataAdminBundle “Admin is not only about Model; but about providing a consistent and rich user experience for managing data.” Thomas Rabaix SYMFONYDAY 2012sabato 6 ottobre 12
  8. 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 2012sabato 6 ottobre 12
  9. 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 2012sabato 6 ottobre 12
  10. 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 2012sabato 6 ottobre 12
  11. 11. INSTALLATION • vi deps && vendors install (branch/2.0 + sf2.0) • composer (master + sf2.1) SYMFONYDAY 2012sabato 6 ottobre 12
  12. 12. CONFIGURATION • autoload.php + AppKernel.php • config.yml + routing.yml SYMFONYDAY 2012sabato 6 ottobre 12
  13. 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 2012sabato 6 ottobre 12
  14. 14. ADMIN CLASS Class as a Service Service Our Admin class Entity Admin pool Dashboard Controller group SYMFONYDAY 2012sabato 6 ottobre 12
  15. 15. DASHBOARD Twitter Quick actions Bootstrap ;) Entities }Group SYMFONYDAY 2012sabato 6 ottobre 12
  16. 16. Filters LIST VIEW Custom fields Actions Export Batch actions SYMFONYDAY 2012sabato 6 ottobre 12
  17. 17. LIST VIEW SYMFONYDAY 2012sabato 6 ottobre 12
  18. 18. LIST VIEW Admin class List Mapper Custom Template Custom Actions SYMFONYDAY 2012sabato 6 ottobre 12
  19. 19. LIST VIEW Actions Route Filters SYMFONYDAY 2012sabato 6 ottobre 12
  20. 20. EDIT / CREATE FORM Associated Entity Properties Entity Collection (ManyToMany with extra fields) Help inline CRUD Actions SYMFONYDAY 2012sabato 6 ottobre 12
  21. 21. EDIT / CREATE FORM Modal windows ;) List View Opera Click to choose association SYMFONYDAY 2012sabato 6 ottobre 12
  22. 22. EDIT / CREATE FORM Create Form Etichette Creating a new associated Entity SYMFONYDAY 2012sabato 6 ottobre 12
  23. 23. EDIT / CREATE FORM Form Mapper Model type Collection type Custom visualization Help inline SYMFONYDAY 2012sabato 6 ottobre 12
  24. 24. MAYBE NOT EVERYONE KNOWS THAT... Form fields template Custom field block SYMFONYDAY 2012sabato 6 ottobre 12
  25. 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 2012sabato 6 ottobre 12
  26. 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 2012sabato 6 ottobre 12
  27. 27. Questions? SYMFONYDAY 2012sabato 6 ottobre 12
  28. 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 2012sabato 6 ottobre 12

×