No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Latest commit a43936a Sep 6, 2013
Failed to load latest commit information.
app Added cache and logs Sep 5, 2013
src Small fix Sep 6, 2013
web Initial checkin Sep 4, 2013
.gitignore Initial checkin Sep 4, 2013
.travis.yml Initial checkin Sep 4, 2013
LICENSE Initial checkin Sep 4, 2013 Update Sep 6, 2013 Initial checkin Sep 4, 2013 Initial checkin Sep 4, 2013
composer.json Initial checkin Sep 4, 2013

Symfony2 and Doctrine2 multiple database example

For more information on this repo please see my article on using multiple databases with Symfony2 here:

How to setup

  • Clone the project: git clone
  • Download composer into the root of the project if needed: curl -s | php
  • Setup permissions on cache and logs directory as shown in the Symfony2 docs:
  • Run composer update to install the various third party libraries needed
  • Create the two test databases 'symfonydemo_post' and 'symfonydemo_user';
  • You can build the databases automatically, simply set the db name in parameters.yml to 'symfonydemo_post' and run 'php app/console doctrine:schema:update' to create the tables, change the db name to 'symfonydemo_user' and repeat the process to build the tables for the User entity.

How to use

Once everything is setup navigation to '/users', from here you can use the autogenerated CRUD interface to add a user.

If you navigate to '/posts' you can add a new post with a user relation, the form can update the relation seamlessly. On the index page you will also see that the username associated with the post is outputted just as any other relation.