@@ -20,6 +20,8 @@ public function createDomainDbFunctions(): void
2020
2121 protected function createDomainIdsByLocaleFunction (): void
2222 {
23+ $ connection = $ this ->em ->getConnection ();
24+ $ databasePlatform = $ connection ->getDatabasePlatform ();
2325 $ domainsIdsByLocale = [];
2426
2527 foreach ($ this ->domain ->getAllIncludingDomainConfigsWithoutDataCreated () as $ domainConfig ) {
@@ -29,15 +31,15 @@ protected function createDomainIdsByLocaleFunction(): void
2931 $ domainIdsByLocaleSqlClauses = [];
3032
3133 foreach ($ domainsIdsByLocale as $ locale => $ domainIds ) {
32- $ sql = 'WHEN locale = \'' . $ locale . '\ ' THEN ' ;
34+ $ sql = 'WHEN locale = ' . $ databasePlatform -> quoteStringLiteral ( $ locale) . ' THEN ' ;
3335
3436 foreach ($ domainIds as $ domainId ) {
3537 $ sql .= ' RETURN NEXT ' . $ domainId . '; ' ;
3638 }
3739 $ domainIdsByLocaleSqlClauses [] = $ sql ;
3840 }
3941
40- $ this -> em -> getConnection () ->executeStatement (
42+ $ connection ->executeStatement (
4143 'CREATE OR REPLACE FUNCTION get_domain_ids_by_locale(locale text) RETURNS SETOF integer AS $$
4244 BEGIN
4345 CASE
@@ -51,15 +53,17 @@ protected function createDomainIdsByLocaleFunction(): void
5153
5254 protected function createLocaleByDomainIdFunction (): void
5355 {
56+ $ connection = $ this ->em ->getConnection ();
57+ $ databasePlatform = $ connection ->getDatabasePlatform ();
5458 $ localeByDomainIdSqlClauses = [];
5559
5660 foreach ($ this ->domain ->getAllIncludingDomainConfigsWithoutDataCreated () as $ domainConfig ) {
5761 $ localeByDomainIdSqlClauses [] =
5862 'WHEN domain_id = ' . $ domainConfig ->getId ()
59- . ' THEN RETURN \'' . $ domainConfig ->getLocale () . '\ '; ' ;
63+ . ' THEN RETURN ' . $ databasePlatform -> quoteStringLiteral ( $ domainConfig ->getLocale ()) . '; ' ;
6064 }
6165
62- $ this -> em -> getConnection () ->executeStatement (
66+ $ connection ->executeStatement (
6367 'CREATE OR REPLACE FUNCTION get_domain_locale(domain_id integer) RETURNS text AS $$
6468 BEGIN
6569 CASE
0 commit comments