Created
August 22, 2017 10:48
-
-
Save steven-pribilinskiy/7a8089d9af117551fbb9e07a6768d4b1 to your computer and use it in GitHub Desktop.
Symfony router:match helper
This file contains 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
# Symfony router:match | |
rtm() { | |
url=$1 | |
# remove domain | |
url=`echo $url | sed -r 's#.*//[^/]+##g'` | |
# add leading slash | |
firstChar="${url:0:1}" | |
[ ! $firstChar == "/" ] && url=/$url | |
match=$(script -q -c "core/symfony/app/backend/console router:match $url") | |
if [[ $match = *'None of the routes match'* ]] | |
then | |
console router:match $url/ | |
else | |
echo "$match" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment