Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Developing Web Apps with Symfony2, Doctrine and...
Search
Amal Raghav
October 26, 2012
Programming
4
230
Developing Web Apps with Symfony2, Doctrine and MongoDB
Amal Raghav
October 26, 2012
Tweet
Share
Other Decks in Programming
See All in Programming
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
570
CDK引数設計道場100本ノック
badmintoncryer
1
300
Advanced Micro Frontends: Multi Version/ Framework Scenarios @WAD 2025, Berlin
manfredsteyer
PRO
0
350
AIと”コードの評価関数”を共有する / Share the "code evaluation function" with AI
euglena1215
1
170
なぜ適用するか、移行して理解するClean Architecture 〜構造を超えて設計を継承する〜 / Why Apply, Migrate and Understand Clean Architecture - Inherit Design Beyond Structure
seike460
PRO
3
780
チームのテスト力を総合的に鍛えて品質、スピード、レジリエンスを共立させる/Testing approach that improves quality, speed, and resilience
goyoki
5
1k
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
830
ソフトウェア品質を数字で捉える技術。事業成長を支えるシステム品質の マネジメント
takuya542
2
14k
ご注文の差分はこちらですか? 〜 AWS CDK のいろいろな差分検出と安全なデプロイ
konokenj
3
410
20250704_教育事業におけるアジャイルなデータ基盤構築
hanon52_
5
900
状態遷移図を書こう / Sequence Chart vs State Diagram
orgachem
PRO
2
170
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
0
160
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1370
200k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Designing for humans not robots
tammielis
253
25k
A better future with KSS
kneath
238
17k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
The Pragmatic Product Professional
lauravandoore
35
6.7k
Site-Speed That Sticks
csswizardry
10
700
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Six Lessons from altMBA
skipperchong
28
3.9k
Being A Developer After 40
akosma
90
590k
Transcript
Developing Web Apps with Symfony2, Doctrine and MongoDB Friday, 26
October 12
Who Am I? •Software Engineer at TechJini Solutions •Working with
PHP/Symfony for last 4 years •@kertz on Twitter and Github Friday, 26 October 12
The Whys? •Why Symfony2? •Why Doctrine? Friday, 26 October 12
Symfony2 •Made of reusable components •A community that built Doctrine,
Behat, Composer, Assetic and more •The backbone for future versions of Drupal & phpBB Friday, 26 October 12
Doctrine •Highly configurable •Supports MySQL, PgSQL, Oracle, SQlite, MongoDB and
CouchDB •Doctrine Query Language Friday, 26 October 12
Installation • Composer Dependency Manager (http:// getcomposer.org) $ curl -s
http://getcomposer.org/installer | php $ php composer.phar create-project symfony/framework- standard-edition sf-mongo 2.1.x-dev Friday, 26 October 12
Adding MongoDB { "require": { "doctrine/mongodb-odm-bundle": "3.0.*" }, "minimum-stability": "dev"
} $ composer.phar update doctrine/mongodb-odm-bundle composer.json AppKernel.php Friday, 26 October 12
Configuration doctrine_mongodb: connections: default: server: mongodb://localhost:27017 options: {} default_database: sfmongo
document_managers: default: auto_mapping: true config.yml Friday, 26 October 12
Bundles •Why Bundles? •Creating your own bundles $ app/console generate:bundle
Friday, 26 October 12
Register Bundles AppKernel.php Friday, 26 October 12
What are we building? •A simple image sharing app •Store/Retrieve
images in/from GridFS •Allow comments for images Friday, 26 October 12
Image.php The Document schema for images Friday, 26 October 12
ImageController.php Controller for uploading images Friday, 26 October 12
new.html.twig The template for uploading images Friday, 26 October 12
ImageController.php Retrieving the images Friday, 26 October 12
In Retrospect •A form to upload an image and add
caption •Store images in MongoDB with GridFS •Retrieve images •That was quick, wasn’t it? Friday, 26 October 12
Comment.php The Document schema for comments Friday, 26 October 12
Image.php Add a reference to comments Friday, 26 October 12
ImageController.php Controller for comments Friday, 26 October 12
ImageController.php comments.html.twig Viewing comments for images Friday, 26 October 12
In Retrospect (again) •Allow comments for image •Show comments for
images by id Friday, 26 October 12
Repositories & DQL • Create custom repositories • Using Doctrine
Query Builder Friday, 26 October 12
CommentRepository.php Repository for comments Friday, 26 October 12
Set repository location Comment.php Friday, 26 October 12
CommentController.php Calling Repository functions Friday, 26 October 12
Bundles to watch •SonataAdminBundle http://github.com/sonata-project/SonataAdminBundle •FOSUserBundle http://github.com/FriendsOfSymfony/FOSUserBundle •FOQElasticaBundle http://github.com/Exercise/FOQElasticaBundle Friday,
26 October 12
The End. Questions? Friday, 26 October 12