Skip to content

Instantly share code, notes, and snippets.

@olek07
Created December 29, 2019 17:54
Show Gist options
  • Save olek07/10a806ae8edaf07f094250263cbbba93 to your computer and use it in GitHub Desktop.
Save olek07/10a806ae8edaf07f094250263cbbba93 to your computer and use it in GitHub Desktop.
parameters:
# Adds a fallback DATABASE_URL if the env var is not set.
# This allows you to run cache:warmup even if your
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL): ''
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_pgsql'
charset: utf8
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
url: '%env(resolve:DATABASE_URL)%'
types: # register the new types
jsonb:
class: MartinGeorgiev\Doctrine\DBAL\Types\Jsonb
commented: false
jsonb[]:
class: MartinGeorgiev\Doctrine\DBAL\Types\JsonbArray
commented: false
smallint[]:
class: MartinGeorgiev\Doctrine\DBAL\Types\SmallIntArray
commented: false
integer[]:
class: MartinGeorgiev\Doctrine\DBAL\Types\IntegerArray
commented: false
bigint[]:
class: MartinGeorgiev\Doctrine\DBAL\Types\BigIntArray
commented: false
text[]:
class: MartinGeorgiev\Doctrine\DBAL\Types\TextArray
commented: false
mapping_types:
jsonb: jsonb
jsonb[]: jsonb[]
_jsonb: jsonb[]
smallint[]: smallint[]
_int2: smallint[]
integer[]: integer[]
_int4: integer[]
bigint[]: bigint[]
_int8: bigint[]
text[]: text[]
_text: text[]
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware_fallback
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
dql:
string_functions:
# own functions
TYPE: App\Doctrine\ORM\Functions\TypeFunction
# alternative implementation of ALL() and ANY() where subquery is not required, useful for arrays
ALL_OF: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\All
ANY_OF: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Any
# operators for working with array and json(b) data
CONTAINS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Contains
IS_CONTAINED_BY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\IsContainedBy
OVERLAPS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Overlaps
GREATEST: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Greatest
LEAST: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Least
# array specific functions
ARRAY_APPEND: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayAppend
ARRAY_CARDINALITY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayCardinality
ARRAY_CAT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayCat
ARRAY_DIMENSIONS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayDimensions
ARRAY_LENGTH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayLength
ARRAY_NUMBER_OF_DIMENSIONS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayNumberOfDimensions
ARRAY_PREPEND: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayPrepend
ARRAY_REMOVE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayRemove
ARRAY_REPLACE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayReplace
ARRAY_TO_JSON: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJson
ARRAY_TO_STRING: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToString
STRING_TO_ARRAY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\StringToArray
IN_ARRAY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\InArray
# json specific functions
JSON_ARRAY_LENGTH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLength
JSON_EACH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEach
JSON_EACH_TEXT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachText
JSON_GET_FIELD: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonGetField
JSON_GET_FIELD_AS_INTEGER: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonGetFieldAsInteger
JSON_GET_FIELD_AS_TEXT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonGetFieldAsText
JSON_GET_OBJECT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonGetObject
JSON_GET_OBJECT_AS_TEXT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonGetObjectAsText
JSON_OBJECT_KEYS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonObjectKeys
JSON_STRIP_NULLS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonStripNulls
TO_JSON: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToJson
# jsonb specific functions
JSONB_ARRAY_ELEMENTS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbArrayElements
JSONB_ARRAY_ELEMENTS_TEXT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbArrayElementsText
JSONB_ARRAY_LENGTH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbArrayLength
JSONB_EACH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbEach
JSONB_EACH_TEXT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbEachText
JSONB_EXISTS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbExists
JSONB_INSERT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbInsert
JSONB_OBJECT_KEYS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbObjectKeys
JSONB_SET: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbSet
JSONB_STRIP_NULLS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbStripNulls
TO_JSONB: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToJsonb
# text search specific
TO_TSQUERY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToTsquery
TO_TSVECTOR: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToTsvector
TSMATCH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Tsmatch
# other operators
ILIKE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Ilike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment