mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'add-doctrine-dbal-configuration-in-the-bundle' into 'master'
Add Doctrine DBAL postgis configuration in the bundle. See merge request Chill-Projet/chill-bundles!65
This commit is contained in:
commit
73790db700
@ -35,6 +35,8 @@ use Chill\MainBundle\Doctrine\DQL\OverlapsI;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Chill\MainBundle\Doctrine\DQL\Replace;
|
||||
use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType;
|
||||
use Chill\MainBundle\Doctrine\Type\PointType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
@ -167,37 +169,49 @@ 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,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
);
|
||||
|
||||
//add dbal types (default entity_manager)
|
||||
$container->prependExtensionConfig('doctrine', array(
|
||||
'dbal' => [
|
||||
'types' => [
|
||||
'dateinterval' => [
|
||||
'class' => \Chill\MainBundle\Doctrine\Type\NativeDateIntervalType::class
|
||||
],
|
||||
'point' => [
|
||||
'class' => \Chill\MainBundle\Doctrine\Type\PointType::class
|
||||
]
|
||||
]
|
||||
]
|
||||
));
|
||||
$container
|
||||
->prependExtensionConfig(
|
||||
'doctrine',
|
||||
[
|
||||
'dbal' => [
|
||||
// This is mandatory since we are using postgis as database.
|
||||
'mapping_types' => [
|
||||
'geometry' => 'string',
|
||||
],
|
||||
'types' => [
|
||||
'dateinterval' => [
|
||||
'class' => NativeDateIntervalType::class
|
||||
],
|
||||
'point' => [
|
||||
'class' => PointType::class
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
//add current route to chill main
|
||||
$container->prependExtensionConfig('chill_main', array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user