70 likes | 219 Views
Symfony2 - Step-by-step. Portfolio 3.0 Symfony 2.0 MongoDB jQuery UI RESTfull services. Week 2 – Symfony 2 Advanced. Purpose: a completed blog application Requirements: ORM – entities with relationships Form advanced Twig with layouts. 1 – ORM Entities relationship.
E N D
Symfony2 - Step-by-step • Portfolio 3.0 • Symfony 2.0 • MongoDB • jQuery UI • RESTfull services
Week 2– Symfony2 Advanced • Purpose: a completed blog application • Requirements: • ORM – entities with relationships • Form advanced • Twig with layouts
1 – ORM Entities relationship • Requirements: • Add entities Post, Comment, Category • Add relationships (described in next slide) • Tutorial: http://symfony.com/doc/current/book/doctrine.html#entity-relationships-associations • Achievement: • OneToMany, ManyToMany • Fetch relative objects • Notice: • Add relationships in Entity then generate to database.
Relationships: • Blog vs Post: • Blog can have 0-many Posts • Post only belong to a Blog • Post vs Comment: • Post can have 0-many Comments • Comment only belong to a Post • Post vs Category: • Post can have to 0-many Category • Category can have 0-many Post • Category: • Category can have 0-many Category children
2 – ORM Repository • Requirements: • Create 4 custom repository classes for 4 entities • Write some custom functions (see in note) • Tutorial: http://symfony.com/doc/current/book/doctrine.html#custom-repository-classes • Achievement: • Query Builder with DQL • Join tables. • Note: • Use setParameter() • ORM Expr class
3 – Layouts • Requirements: • Create a layout with the design layout.png • 4 sections (header, footer, left, content) should be in separated view. • Assert to add css, javascript, image to layout. • HTML5 Boilerplate • Tutorial: http://symfony.com/doc/current/book/templating.html • Achievement: • Block • Twig render, include functions • Assert • Note: • Must use Block • Must use Assert
4 – Blog Application • Requirements: • Build a complete application • Achievement: • Pages management • Routing • Layouting • Note: • Page listing in notes • Link all available pages in views