More Related Content Similar to Developing Web Apps with Symfony2, Doctrine and MongoDB (20) Developing Web Apps with Symfony2, Doctrine and MongoDB2. Who Am I?
• Software Engineer at TechJini Solutions
• Working with PHP/Symfony for last 4 years
• @kertz on Twitter and Github
4. Symfony2
• Made of reusable components
•Acommunity that built Doctrine, Behat,
Composer, Assetic and more
• Thebackbone for future versions of Drupal &
phpBB
5. Doctrine
• Highly configurable
• Supports
MySQL, PgSQL, Oracle, SQlite,
MongoDB and CouchDB
• Doctrine Query Language
6. Installation
• ComposerDependency 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
7. Adding MongoDB
composer.json
{
"require": {
"doctrine/mongodb-odm-bundle": "3.0.*"
},
"minimum-stability": "dev"
}
$ composer.phar update doctrine/mongodb-odm-bundle
AppKernel.php
8. Configuration
config.yml
doctrine_mongodb:
connections:
default:
server: mongodb://localhost:27017
options: {}
default_database: sfmongo
document_managers:
default:
auto_mapping: true
9. Bundles
• Why Bundles?
• Creating your own bundles
$ app/console generate:bundle
11. What are we building?
•A simple image sharing app
• Store/Retrieve images in/from GridFS
• Allow comments for images
16. 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?
26. Bundles to watch
• SonataAdminBundle http://github.com/sonata-project/SonataAdminBundle
• FOSUserBundle http://github.com/FriendsOfSymfony/FOSUserBundle
• FOQElasticaBundle http://github.com/Exercise/FOQElasticaBundle
Editor's Notes \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n