For the most part, the README file associated to this plugin is fairly straight forward, and should be followed. This post is here to demonstrate an install method you can do manually and not have to re-load all of your data and loading fixtures.

–Update 4.9.10 –

I removed some sections from this post b/c they were deprecated. Also, check out as it has a lot of useful information beyond the README.txt file.

Build SQL

This step will use your config/doctrine/schema.yml file and create a sql file you can use for creating the schema in your database.

php symfony doctrine:build-sql

Implement Schema

Now we are at the step that caused us to do everything the hard way (manual). If you follow the README file associated /w a plugin it will tell you to run ‘symfony doctrine:insert-sql’. If you do this you are basically wiping out any data you have in your database b/c the tables will be re-created.

Instead of wiping out existing data we are going to copy everything we want out of the data/sql/schema.sql file and put them into a data/sql/sfGuardDoctrine.sql file. This way when you import the schema to your database you will not wipe out your existing data.

touch data/sql/sfGuardDoctrine.sql
vi data/sql/schema.sql

Copy all sf_guard_* table references.

vi data/sql/sfGuardDoctrine.sql

Paste all copied data and save file. Now you are going to import the sfGuardDoctrine schema into your database:

mysql -h <db_host> -u <db_user> -p <db_name> < data/sql/sfGuardDoctrine.sql

If the command ran successfully then you should be able to connect to your database and see the new sf_guard_* tables in place.

Add User via CLI

./symfony guard:create-user <username> <password>


You should be able to finish up the setup of this plugin by referring to the plugins/sfDoctrineGuardPlugin/README file or the link posted earlier.