Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
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
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