Skip to content

Instantly share code, notes, and snippets.

@COil
Created May 19, 2012 12:24
Show Gist options
  • Save COil/2730653 to your computer and use it in GitHub Desktop.
Save COil/2730653 to your computer and use it in GitHub Desktop.
Bash script to generate doctrine files for a given entity
#!/bin/bash
clear;
echo "> Generating the Doctrine files for a given Entity, be careful that the entities are camel-cased"
# Testing arguments
EXPECTED_ARGS=1
E_BADARGS=65
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: ./`basename $0` MyEntity"
exit $E_BADARGS
fi
php app/console doctrine:mapping:convert yml ./src/MyNamespace/Bundle/MyBundle/Resources/config/doctrine/metadata/orm --from-database --force --filter=$1
php app/console doctrine:mapping:import MyBundle annotation --filter=$1
php app/console doctrine:generate:entities MyNamespace\\Bundle\\MyBundle\\Entity\\$1
echo " --> Done!"
@COil
Copy link
Author

COil commented Oct 2, 2012

Of course the path MyNamespace/Bundle/MyBundle has to be modified to fit your needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment