tourze / doctrine-function-bundle
Doctrine函数增强模块
0.0.1
2025-04-19 07:39 UTC
Requires
- php: ^8.1
- beberlei/doctrineextensions: ^1.5.0
- doctrine/doctrine-bundle: ^2.13
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/framework-bundle: ^6.4
- symfony/http-kernel: ^6.4
- symfony/yaml: ^6.4 || ^7.1
- tourze/doctrine-function-collection: 0.0.*
Requires (Dev)
- phpstan/phpstan: ^2.1
This package is auto-updated.
Last update: 2025-04-25 19:14:02 UTC
README
A Symfony bundle for registering custom Doctrine SQL functions.
Features
- Automatically registers custom SQL functions for Doctrine ORM
- Supports multiple function types:
- String functions (JSON_EXTRACT, ANY_VALUE, etc.)
- Datetime functions (DAY, MONTH, YEAR, etc.)
- Numeric functions (ACOS, SIN, TAN, etc.)
- Zero configuration required
- Integrates with Doctrine ORM
Installation
composer require tourze/doctrine-function-bundle
Quick Start
- Register the bundle in your Symfony application:
// config/bundles.php return [ // ... Tourze\DoctrineFunctionBundle\DoctrineFunctionBundle::class => ['all' => true], ];
-
No additional configuration needed - all functions are automatically registered.
-
Use the functions in your DQL queries:
$query = $entityManager->createQuery(' SELECT e FROM AppBundle:Entity e WHERE JSON_EXTRACT(e.data, "$.property") = :value '); $query->setParameter('value', 'test');
Testing
Run PHPUnit from the project root:
vendor/bin/phpunit -c phpunit.xml packages/doctrine-function-bundle/tests
License
The MIT License (MIT). Please see License File for more information.