Skip to content

Instantly share code, notes, and snippets.

@ColonelMoutarde
Last active February 3, 2021 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ColonelMoutarde/0a8e74d3ead9033df6ebf12b9726e5ed to your computer and use it in GitHub Desktop.
Save ColonelMoutarde/0a8e74d3ead9033df6ebf12b9726e5ed to your computer and use it in GitHub Desktop.
slugify SQL
$this->addSql(
"UPDATE matable SET slug =
concat(
lower(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(title,'\'','-')
, 'ù','u')
, 'ç','c')
,'û','u')
,'ô','o')
,'â','a')
, 'ï', 'i')
, 'î', 'i')
, 'ë', 'e')
, 'ê', 'e')
, 'à', 'a')
, 'è', 'e')
, ' ', '-')
, 'é', 'e')
, '.', '')
), SUBSTRING(id, 3, 3))" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment