Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Back-end con SonataAdminBundle (e Symfony2, of course...)
1. BACK-END CON
SONATA ADMIN BUNDLE
E SYMFONY2, OF COURSE...
Andrea Delfino
andrea.delfino@gmail.com
SYMFONYDAY 2012
sabato 6 ottobre 12
2. •Sviluppatore da 10+ anni (web e non)
•Anche un pò SysAdmin (DevOps ❤)
•Lavoro per Skuola.net (giù a piano terra)
•Mi piace il Software Libero
•Condivido (Web, LUG, ..., PUG)
@ottimo
https://github.com/andreadelfino
PUG Torino: http://torino.grusp.org
SYMFONYDAY 2012
sabato 6 ottobre 12
3. IL PROBLEMA
TEMPO
Abbiamo poco tempo per sviluppare il back-end
SYMFONYDAY 2012
sabato 6 ottobre 12
4. IL PROBLEMA
ASPETTATIVE
Stiamo effettuando una migrazione da un CMS con un
buon back-end
SYMFONYDAY 2012
sabato 6 ottobre 12
5. LA SOLUZIONE
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. OPPURE
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
• Stato attuale: 13 bundles e qualche libreria
SYMFONYDAY 2012
sabato 6 ottobre 12
9. CARATTERISTICHE
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
Template custom
Azioni
SYMFONYDAY 2012
sabato 6 ottobre 12
19. LIST VIEW
Rotte azioni
Filtri
SYMFONYDAY 2012
sabato 6 ottobre 12
20. EDIT / CREATE FORM
Entità relazionata
Proprietà
Collezione di
entità
relazionate
Help inline
Azioni CRUD
SYMFONYDAY 2012
sabato 6 ottobre 12
21. EDIT / CREATE FORM
Modal windows ;)
List View
Opera
Click per modificare
l’associazione
SYMFONYDAY 2012
sabato 6 ottobre 12
22. EDIT / CREATE FORM
Create Form
Etichette
Creazione una nuova entità da associare
SYMFONYDAY 2012
sabato 6 ottobre 12
23. EDIT / CREATE FORM
Form Mapper
Tipo Model per le entità relazionate
Tipo Collection
Visualizzazione custom
Help inline
SYMFONYDAY 2012
sabato 6 ottobre 12
24. FORSE NON TUTTI SANNO CHE...
Form fields template
Custom field block
SYMFONYDAY 2012
sabato 6 ottobre 12
25. ALTRE CARATTERISTICHE
•Controller per azioni custom e batch
•Lifecycle Callbacks
•Validazione
•Personalizzazione avanzata dei Templates
•Paginazione
•Sidebar e Menu (via KnpMenuBundle)
•Traduzione (10+ lingue, Italiano incluso)
•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
• Molto potente e flessibile
• Comunità attiva (>260 fork, >50 contrib)
•Manca ancora unacarenterelease (anche se vicina per sf2.0)
stable
• Documentazione
• Versione “master” per sf2.1 non sempre stabile
Being a Good OSS Contributor - Jeremy Mikola (http://joind.in/talk/view/7216)
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