From bafbc2dd74824cf5f7d0315b7655ea88f0538d80 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 25 May 2021 07:57:12 +0200 Subject: [PATCH] Add Doctrine DBAL postgis configuration in the bundle. This can now be removed totally from the user application. --- .../ChillMainExtension.php | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 277e916a8..8507687bc 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -167,23 +167,33 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface, $container->prependExtensionConfig('twig', $twigConfig); //add DQL function to ORM (default entity_manager) - $container->prependExtensionConfig('doctrine', array( - 'orm' => array( - 'dql' => array( - 'string_functions' => array( - 'unaccent' => Unaccent::class, - 'GET_JSON_FIELD_BY_KEY' => GetJsonFieldByKey::class, - 'AGGREGATE' => JsonAggregate::class, - 'REPLACE' => Replace::class, - ), - 'numeric_functions' => [ - 'JSONB_EXISTS_IN_ARRAY' => JsonbExistsInArray::class, - 'SIMILARITY' => Similarity::class, - 'OVERLAPSI' => OverlapsI::class - ] - ) - ) - )); + $container + ->prependExtensionConfig( + 'doctrine', + [ + 'orm' => [ + 'dql' => [ + 'string_functions' => [ + 'unaccent' => Unaccent::class, + 'GET_JSON_FIELD_BY_KEY' => GetJsonFieldByKey::class, + 'AGGREGATE' => JsonAggregate::class, + 'REPLACE' => Replace::class, + ], + 'numeric_functions' => [ + 'JSONB_EXISTS_IN_ARRAY' => JsonbExistsInArray::class, + 'SIMILARITY' => Similarity::class, + 'OVERLAPSI' => OverlapsI::class, + ], + ], + ], + // This is mandatory since we are using postgis as database. + 'dbal' => [ + 'mapping_types' => [ + 'geometry' => 'string', + ], + ], + ], + ); //add dbal types (default entity_manager) $container->prependExtensionConfig('doctrine', array(