Symfony: Quick way to change bundle name

You have generated a new bundle under src/Oldnamespace/oldbundle and decided to change the bundle name or move it to a new name space. Symfony doesn’t provide any tools to do that. Sounds like a tedious job…

There is no short cut to this solution but some Bash scripting can save your lots of time. Use it at your own risk. Mass replace could replace stuff that you dont want though..

# in the bundle folder
find . -type f | while read s; do sed -i 's/Oldnamespace\OldBundle/Newnamespace\NewBundle/g' $s ; done
find . -type f | while read s; do sed -i 's/OldnamespaceOldBundle/NewnamespaceNewBundle/g' $s ; done
find . -type f | while read s; do sed -i 's/OldnamespaceOldBundle/NewnamespaceNewBundle/g' $s ; done
# now renaming dir and files
find . | grep Article | xargs rename Article Page -

Once done, change the bundle folder name and configuration in app/AppKernel.php, app/config/routing.yml, app/config/config.yml