Skip to content

Instantly share code, notes, and snippets.

@gronostajo
Last active August 9, 2017 12:37
Show Gist options
  • Save gronostajo/b345b51ad60dd701bf0f538e7e0ecb9c to your computer and use it in GitHub Desktop.
Save gronostajo/b345b51ad60dd701bf0f538e7e0ecb9c to your computer and use it in GitHub Desktop.
Enable SyslogicNL/DoctrineJsonFunctions in Symfony

Enable SyslogicNL/DoctrineJsonFunctions in Symfony

SyslogicNL/DoctrineJsonFunctions extends Doctrine with support for PostgreSQL's native JSON operators. Add this to your top-level config or put this file somewhere and import it:

imports:
  - { resource: "@SomeBundle/Resources/config/postgres_json_functions.yml" }
doctrine:
orm:
dql:
string_functions:
json_get: Syslogic\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonGet
json_get_text: Syslogic\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonGetText
json_get_path: Syslogic\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonGetPath
json_get_path_text: Syslogic\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonGetPathText
numeric_functions:
jsonb_exists: Syslogic\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonbExists
jsonb_exists_any: Syslogic\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonbExistsAny
jsonb_exists_all: Syslogic\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonbExistsAll
jsonb_contains: Syslogic\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonbContains
jsonb_is_contained: Syslogic\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonbIsContained
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment