Created
May 19, 2012 12:24
-
-
Save COil/2730653 to your computer and use it in GitHub Desktop.
Bash script to generate doctrine files for a given entity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Of course the path
MyNamespace/Bundle/MyBundle
has to be modified to fit your needs.